Direct JDBC for PostgreSQL and Confluence in Docker

I have pulled the docker image for Confluence and want to connect it to my PostgreSQL database.

I have followed this instruction for creating the user and database in PostgreSQL:

and from Atlassian:

But during the installation process of confluence there is an error:

Configuring database failed
org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

In the setup field I just left the standard input:

DriverClassName: org.postgresql.Driver

DatabaseURL: jdbc:postgresql://localhost:5432/confluence

Username and Password

I have installed apt-get install libpostgresql-jdbc-java and got libpostgresql-jdbc-java (9.2-1002-1)

However, I can not fix this error. Could someone please give me a hint what else I could figure out.

ps -f -u postgres

ps -f -u postgres
postgres  3718     1  0 14:09 ?        00:00:00 /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postg
postgres  3720  3718  0 14:09 ?        00:00:00 postgres: checkpointer process   
postgres  3721  3718  0 14:09 ?        00:00:00 postgres: writer process   
postgres  3722  3718  0 14:09 ?        00:00:00 postgres: wal writer process   
postgres  3723  3718  0 14:09 ?        00:00:00 postgres: autovacuum launcher process   
postgres  3724  3718  0 14:09 ?        00:00:00 postgres: stats collector process  

sudo netstat -ltnp | grep postgres

tcp        0      0*               LISTEN      3718/postgres   
tcp6       0      0 ::1:5432                :::*                    LISTEN      3718/postgres   

sudo lsof -n -u postgres |grep LISTEN

postgres 3718 postgres    6u  IPv4              23608      0t0     TCP (LISTEN)
postgres 3718 postgres    7u  IPv6              23609      0t0     TCP [::1]:postgresql (LISTEN)

1 answer

1 vote

Postgres is definitely running, but with those settings, can you just confirm that it is on the same machine as Confluence?

If it is, then the error message you are seeing is good - it says the right drivers are in place (although your apt-get is of zero use - it installs the drivers somewhere else.  You'll have picked up the default ones distributed with Confluence).  It is now simply that it is being refused a connection, so your user/password is wrong, or it's not being allowed in because of the settings in the database.

Thank you for your fast reply. Yes, everything is on the same server. Confluence is running in Docker.

However, it is probably easier if I just run the installer of Confluence since I have read that Docker has some limitations in terms of using OpenJDK. Probably this is causing the issue?

Confluence does not run properly on OpenJDK - use the java that comes with the Confluence installation.

That doesn't affect the database drivers though.  It still sounds like the credentials are wrong, or the user has no db access.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Tuesday in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

206 views 2 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you