I am trying to put my PostgreSQL DB onto Google Cloud SQL but encounter an error. To reproduce the error I do the following:
mvn install
export GOOGLE_APPLICATION_CREDENTIALS=yyy.json
java -jar target/quarkus-app/quarkus-run.jar
Which throws the following error:
org.postgresql.util.PSQLException: FATAL: database "XXX" does not exist
When looking at the official documentation of quarkus it mentions that I need to set the following properties:
quarkus.datasource.db-kind=other
quarkus.datasource.jdbc.url=jdbc:postgresql:///XXX
quarkus.datasource.jdbc.driver=org.postgresql.Driver
quarkus.datasource.username=quarkus
quarkus.datasource.password=quarkus
quarkus.datasource.jdbc.additional-jdbc-properties.cloudSqlInstance=project-id:gcp-region:instance
quarkus.datasource.jdbc.additional-jdbc-properties.socketFactory=com.google.cloud.sql.postgres.SocketFactory
I assume I did not enter the correct database name on the second line (quarkus.datasource.jdbc.url
)
What url should be given as a property? The public IP address, the connection name, ...?
Posting this as a community wiki so that others can benefit from it.
XXX must be the database name. When you create your Cloud SQL instance, it's a database engine with a default database and you can also create your own database.