I can configure connection from local machine using sql auth proxy but I can't from cloud run springboot application with hikaricp to a cloud sql with public ip using unix socket. Somebody have a complete example? I read in gcp doc that I don't need to create a docker for sql auth proxy for connection from cloud run to cloud sql.It's created when you define db connection in configuration of cloud run.
POM.xml added below dependency:
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>mysql-socket-factory</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
I set it and next I defined in application the follow application properties (by classic jdbc works fine adding my ip in cloud sql to allow connection but I need to use sql auth proxy by unix socket to avoid to add a vpc, I will not explain reasone too long and boring) for hikariCP:
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql:///DBSCHEMA
spring.datasource.username=username
spring.datasource.password=password
spring.datasource.socketFactory=com.google.cloud.sql.mysql.SocketFactory
spring.datasource.cloudSqlInstance=GCP_PROJECT:GCP_REGION:DBNAME
spring.datasource.ipTypes=PUBLIC
logging.level.com.zaxxer.hikari=TRACE
Somebody can help me with some example that works fine? If in your example created docker for sql auth proxy please explain it. In internet I can't find resource clearly talking about this configuration.
Thanks a lot.