Hi Team,
Recently we have upgraded cloud mysql instance version from 5.7 to 8 then upgraded mysql-connector jar version to 9.2.0 and mysql-socket-factory-connector jar version to 8-1.23.1 with these changes I'm able to connect the new version from my local machine server using cloud proxy connection but when I deploy the same build in GCP app engine standard server its throwing the below error log in app engine server ...
javax.persistence.PersistenceException: Exception [EclipseLink-4021] (Eclipse Persistence Services - 2.7.13.v20230724-7ffb888abf): org.eclipse.persistence.exceptions.DatabaseException Exception Description: Unable to acquire a connection from driver [com.mysql.cj.jdbc.Driver], user [root] and URL [jdbc:google:mysql://google.com:cts-gps:us-central1:****/***db?user=root]. Verify that you have set the expected driver class and URL. Check your login, persistence.xml or sessions.xml resource. The jdbc.driver property should be set to a class that is compatible with your database platform
and below error in databse log ..
[MY-010914] [Server] Aborted connection 36362 to db: '****db' user: 'root' host: 'cloudsqlproxy~34.96.47.0' (Got an error reading communication packets)
I'm using the latest driver class but still could not understand why its failing in cloud environment ..?
any solution or suggestions would be appreciated
Solved! Go to Solution.
This issue is resolved by changing the cloud databse url and using jdbc-socket-factory-core-1.24.0 jar and its dependencies
Old cloud url :- jdbc:mysql://google.com:******:us-central1:Instancename/DBname?autoReconnect=true?useUnicode=yes&characterEncoding=UTF-8;useSSL=false;socketFactory=com.google.cloud.sql.mysql.SocketFactory
New cloud url :- jdbc:mysql://google.com/DBname?cloudSqlInstance=google.com:****:us-central1:Instancename&socketFactory=com.google.cloud.sql.mysql.SocketFactory
Hi @Lakshminarayanv,
Have you updated your XML file with the correct version of your socket and other driver? Please try if not, and if the issue still persists, please try to upgrade your MySQL socket factory connector to 1.24.0 and also upgrade your MySQL instance version to 8.4. The error you are getting might be due to driver compatibility and connection issues, please try to look at this troubleshooting guide and connection issues checklist.
For your additional checking with your issue, you might want to check your logs explorer for more details and this list of operational errors.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.
Hi @ronnelg
Thanks for your response I tried with latest MySQL socket factory connector to 1.24.0 jar and with driver class com.mysql.cj.jdbc.Driver but still getting the same error javax.persistence.PersistenceException: Exception [EclipseLink-4021] (Eclipse Persistence Services - 2.7.15.v20240516-53511fdbd8): org.eclipse.persistence.exceptions.DatabaseException Exception Description: Unable to acquire a connection from driver [com.mysql.cj.jdbc.Driver], user [root] and URL [jdbc:google:mysql://google.com:cts-gps:us-central1:r*d*/r*d*db?user=root]. Verify that you have set the expected driver class and URL. Check your login, persistence.xml or sessions.xml resource. The jdbc.driver property should be set to a class that is compatible with your database platform Internal Exception: java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long Error Code: 0
DB log :-
[Server] Aborted connection 71695 to db: 'r*d*db' user: 'root' host: 'cloudsqlproxy~34.96.47.59' (Got an error reading communication packets).
This issue is resolved by changing the cloud databse url and using jdbc-socket-factory-core-1.24.0 jar and its dependencies
Old cloud url :- jdbc:mysql://google.com:******:us-central1:Instancename/DBname?autoReconnect=true?useUnicode=yes&characterEncoding=UTF-8;useSSL=false;socketFactory=com.google.cloud.sql.mysql.SocketFactory
New cloud url :- jdbc:mysql://google.com/DBname?cloudSqlInstance=google.com:****:us-central1:Instancename&socketFactory=com.google.cloud.sql.mysql.SocketFactory