Camunda RDS Postgres

Hello,

I am trying to deploy camunda in AWS as a Docker Container and connect it to an RDS Postgres Database. I created an RDS Instance and inside of it I have several databases. The one that I want to connect to is called “myDB”. For the camunda container deployment I use the following envroment variables:

  • USER=admin
  • PASSWORD=admin
  • DB_DRIVER=org.postgresql.Driver
  • DB_URL=jdbc:postgresql://secrds.******.eu-central-1.rds.amazonaws.com:5432/rdsname/myDB
  • DB_USERNAME=admin
  • DB_PASSWORD=admin

The deployment does not work. Is the syntax I am using for the DB_URL correct? (With the “/myDB” at the end). Or do I need to specify the database in another enviroment variable? What else could cause the problem?

what is the rdsname from the above jdbc url?

Jdbc url shlould be like this: jdbc:postgresql://secrds.**.eu-central-1.rds.amazonaws.com:5432/myDB

This database connection url connectivity test can be done in PgAdmin (Postgres database client) itself. If you are able to connect with PgAdmin with that jdbc url, then connectivity will work for camunda also.

Sorry I didn’t explain it well. rdsname is the name of the server, and inside of the server I have several Databases. So rdsname contains myDB, myDB2, myDB3… and I want to connect to myDB.

AWS gives me the JDBC link as jdbc:postgresql://secrds.**.eu-central-1.rds.amazonaws.com:5432/rdsname and I added the /myDB at the end.

Also: I connected with PgAdmin already, but for that I used the MasterPGEndPoint link, which looks like this: rdsname.****.eu-central-1.rds.amazonaws.com

Seems you have used only the host of the database instance, so you can able to access/view all the schemas in the postgres instance.

currentSchema = String

Specify the schema to be set in the search-path. This schema will be used to resolve unqualified object names used in statements over this connection.


@jominga If you want to connect to specific schema in the Amazon RDS instance, then jdbc url should look like:

jdbc:postgresql://postgresql-instance1.*******.us-east-1.rds.amazonaws.com:5432/mydatabase?currentSchema=myschema

Just appending this ?currentSchema=<your_schema_name> to the jdbc url will work.

So your jdbc url should be:

jdbc:postgresql://secrds.******.eu-central-1.rds.amazonaws.com:5432/rdsname?currentSchema=myDB

(or)

If it is possible in your environment, you could also set the user’s default schema to your desired schema. By setting this property you no need to pass schema name in connection url:

ALTER USER user_name SET search_path to 'schema_name'

You can find all the postgres jdbc url connection-parameters here.

Than you for your response. There is something I do not yet fully understand. Attached you can find a screenshot of my pgAdmin. As I understand from it myDB is not a schema, but a Database. Am I wrong?

Annotation 2020-04-14 153029

@jominga, I got the problem. So here myDB is not a schema, it’s a database.


Try below, it will work.:

jdbc:postgresql://postgresql-instance1.*******.us-east-1.rds.amazonaws.com:5432/myDB

In myDB, your schema is public schema. So no need to set schema name explicitly.


From the below example:

image

You need to set schema name in the Jdbc connection url, only if you want to connect to non-public schema (secondarySchema like highlighted in the pic) . Because secondarySchema is not a public schema.


Under schema, two schemas listed public (public schema by default) and secondarySchema (non public schema).

Schemas(2):

  • public
  • secondarySchema

So if your intension is to connect to schema = “public” no need to specify in jdbc url, by default postgres jdbc driver connects to default schema only which is “public”.


To connect to public schema:

jdbc:postgresql://postgresql-instance1.*******.us-east-1.rds.amazonaws.com:5432/camundadb

To connect to secondarySchema schema:

jdbc:postgresql://postgresql-instance1.*******.us-east-1.rds.amazonaws.com:5432/camundadb?currentSchema=secondarySchema
2 Likes

Thanks so much! It worked! :grinning: