Java app engine app connectivity issue with cloud sql

Hi Team,

I am currently facing the connectivity to Cloud SQL in our Java App Engine application. Facing the error after upgrading java8 to java17. I have encountered the following error message. String jdbcUrl = String. format("jdbc:mysql://google/%s?cloudSqlInstance=%s&socketFactory=com.google.cloud.sql.mysql.SocketFactory&user=%s&password=%s", DATABASE_NAME, INSTANCE_CONNECTION_NAME, USERNAME, PASSWORD); Error with this code: "Could not initialize class com.google.cloud.sql.mysql.SocketFactory", "java. lang.ClassNotFoundException: com.mysql.jdbc.GoogleDriver

 

2 2 195
2 REPLIES 2

Hi @SwamiSitaram,

Welcome to Google Cloud Community!

- Missing library: Add google-cloud-sql-jdbc-socket-factory dependency.
- Conflicting driver: Remove Class.forName("com.mysql.cj.jdbc.Driver");.
- Check: jdbcUrl, permissions, documentation.

Hi, after adding the google-cloud-sql-jdbc-socket-factory dependency getting the same error msg. Also currently java8 version running and there is no issue with that.. we have an issue after upgrading to java17...

"Exception while createing connection in DBConnManager.java java.lang.ClassNotFoundException: com.mysql.jdbc.GoogleDriver" 

Top Labels in this Space