Connecting to Instaclustr Managed PostgreSQL® and Apache Kafka® from Payara Cloud

by Paul Brebner

This article provides a brief introduction to using Instaclustr’s managed PostgreSQL Database and Apache Kafka from Payara Cloud. It was created to assist entrants in the upcoming Payara Hackathon (you can still sign up!) spin-up and configure some potentially useful Instaclustr technologies for Jakarta EE applications.

Why would you want to use PostgreSQL or Kafka with Jakarta EE?

Here are a few potential reasons:


1.   Sign up for a Free Trial

Go to the “Free Trial” button on our homepage, which takes you to:

No payment details are required, it’s free, the trial is for the non-production SLA tier, a subset of our services and node sizes (only developer-sized nodes, for 30 days.  After 30 days (if you haven’t signed up for a normal subscription) the clusters (and all the data) will be deleted.

2.   PostgreSQL

There are four main steps: (1) Create a PostgreSQL cluster, (2) Allow access, (3) Get connection details and (4) configure Payara cloud to use the PostgreSQL cluster and test (not covered here, see relevant Payara documentation)

2.1 Create a PostgreSQL cluster using the Instaclustr console

Instructions are here:

Summary (unless otherwise instructed, don’t change default values):

1. “Create Cluster”

2. Enter Cluster Name

3. Application Selection: PostgreSQL

4. Provider: AWS

5. No Enterprise Features

Next, PostgreSQL Setup

6.   Select: Version: PostgreSQL 14.10 (Any version 15+ will require changes to permissions, see below)

7. Replication Mode: ASYNCHRONOUS


8. Data Centre Options: Data Centre: Select the region you would like to use.

Next, Next

9. Accept terms

10. Create Cluster

Your cluster will provision and become available after a few minutes.

2.2 Add Payara cloud IPs to the PostgreSQL cluster firewall

For general instructions see here.

Click on your PostgreSQl cluster in the console, and then Firewall Rules.

Add these IPs to the firewall and Save:

These are documented here.

2.3 Get Configuration Details

Documentation on connection to Instaclustr PostgreSQL with Java clients is here.

Specific configuration details are available for your PostgreSQL cluster under Connection Info.

Details include Public and Private IPs, Port number, Username, Password, and Database name.

The user, host, port and dbname are visible under the CLI example (dname=postgres).

Under the Java example you can see the JDBC URL, user and password.

The JDBC URL looks like this:


If you choose Postgres version 15+, you might have to grant create permission on the schema public of your database to be able to execute statements.

See our documentation for further information.

In order to change permissions you will need to:


2.4 Configure Payara Cloud to use PostgreSQL

You may need a PostgreSQL JDBC driver:

You will need to configure the Payara Cloud data source to use the driver with the relevant connection details from 2.3, and test it.

Potentially relevant documentation. And a guide for PostgreSQL (sign up required).

3. Apache Kafka

3.1 Create Kafka Cluster

The process for creating a Kafka Cluster is very similar, see documentation here.

1. Create Cluster

2. Enter Cluster Name

3. Application Selection = Apache Kafka


4. Kafka Setup: Don’t change the defaults (in particular, don’t select “KRaft” mode, as you will be using the older ZooKeeper mode)


5. Data Centre Options: Data Centre: Select desired region.


6. Accept terms

7. Create Cluster

Wait a few minutes

3.2 Allow Access

General instructions.

Add these IPs to the firewall and Save:

3.3. Get Configuration Details

Generic Kafka + Java specific instructions are here.

Specific Kafka connection information is available from the Connection Info tab.

This has Public IPs, User Authorization (Enabled), Encryption (Disabled), etc.

The default username/password are displayed (for 5 days only!). Detailed information is under Examples, Producer/Consumer, Java.

Producer configurations have:





sasl.mechanism=SCRAM-SHA-256 required \

username="user" \


Consumer configuration is identical with the addition of a consumer (In Kafka, multiple consumers can consume from a topic, for increased concurrency, if they are in the same group):

3.4 Configure Payara Cloud to use Kafka

Use the relevant information from 3.3. to configure Payara Cloud to use your Apache Kafka cluster. You can send and receive messages to/from Kafka using Cloud Connectors, JCA and MDBs.  See this documentation.

Note that I couldn’t find where to configure Kafka user/password details.

4.   Further Information

Social Announcement with tagline-1