Wednesday, July 17, 2019

[google-cloud-sql-discuss] Why? Postgres SocketFactory version 1.0.14 does not work but version 1.0.10 works.

So I have been having a difficult day trying to get a connection to my cloud Postgres database. 

Reference I used to connect. 
https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/cloud-sql/postgres/servlet/src/main/java/com/example/cloudsql/ConnectionPoolContextListener.java

Anyway. 
What I found out it that my connection will work if I downgrade to SocketFactorty version 1.0.10 and change the property "cloudSqlInstance" to "socketFactoryArg

So NOT working setup.
Maven dependency:

<dependency>

  <groupId>com.google.cloud.sql</groupId>

  <artifactId>postgres-socket-factory</artifactId>

  <version>1.0.14</version>

</dependency>


Property setting in java.

config.addDataSourceProperty("cloudSqlInstance", CLOUD_SQL_CONNECTION_NAME);


So working setup.

Maven dependency:

<dependency>

  <groupId>com.google.cloud.sql</groupId>

  <artifactId>postgres-socket-factory</artifactId>

  <version>1.0.1o</version>

</dependency>


Property setting in java.

config.addDataSourceProperty("socketFactoryArg"CLOUD_SQL_CONNECTION_NAME);


Now sure I can go with the "old" setup but I always want to use the newest versions. 

Any clue on what I am missing or maybe I'm not that dumb and there is a bug somewhere?


//Eric

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/72253644-1e0a-4bef-9c33-b5b7df234fcb%40googlegroups.com.

No comments:

Post a Comment