0
votes

I have a java application that I want to connect to a Postgres CloudSql instance in Google Cloud Computing. The instance is up and running and I can connect on it using DbVisualizer, but I receive a FATAL: password authentication failed for user "postgres" when I try to connect from the application. I am using the following url, which I suspect might be the cause of the error:

jdbc:postgresql:10.10.10.10

I have intentionally ommited the ip address I am using. Any idea of what can be wrong?

2

2 Answers

0
votes

jdbc:postgresql:10.10.10.10

The correct URI format is jdbc:postgresql://host:port/database.

0
votes

I use the following configuration for connecting to a mysql instance:

dataSource.setUrl(
            "jdbc:mysql://<ipaddress:port>/<database-schema>?cloudSqlInstance=<server-instance-name>&amp;autoReconnect=true&useSSL=false"); 
    dataSource.setUsername(<username>);
    dataSource.setPassword(<password>); 

If you change the jdbc:mysql: to jdbc:postgresql, it should work.