Author: Ashish Singh Chauhan
Introduction
Heroku Postgres is a managed SQL database service provided directly by Heroku. You can access a Heroku Postgres database from any language with a PostgreSQL driver, including all languages officially supported by Heroku.
In this blog, I will show you how to connect with the heroku postgresql database without client security certificates.
Steps of connection
- Add a listener to trigger your flow and configure it.

- Add a Database module in your Mule palette.
Mule palette → Add modules → Database and drop in palette.
- For Setup connection get your connection details from Heroku postgres.
Go to heroku postgres → Settings → Database credentials → View credentials.

- Save connection details i.e Host, Port, Database Name, Username, Password.
- Add the following dependency in pom.xml →
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.1</version>
</dependency>

- Go to global elements → create → Connector configuration → Database config → Select generic connection.
- Configure Url as follows →
jdbc:postgresql://<host>:<port>/<database name>?sslmode=require
Replace your <host>, <port>, <database name> with credentials saved in step 4.
Driver class name – org.postgresql.Driver
Username – <<username>>
Password – <<password>>
After configuring the test connection.
Note – sslmode are of various types, require will make bypass the Certificates verification since we are making this connection without that.

- Add Select component in Mule Flow and write your query in it.

- Run your Mule application and hit the endpoint. You will see the data in your postman.
