Not able to connect to SQL in Google Cloud

387 views
Skip to first unread message

suraj shukla

unread,
Jul 17, 2019, 10:02:07 AM7/17/19
to Google Cloud SQL discuss
I am not able to connect to Cloud SQL in GCP, My spring boot application is hosted in Google Kubernetes, I am able to connect my application to database from my local but when I deploy my application image in kubernetes it doesnt work I checked the logs and got this

{
insertId:  "s=5ae000c9c858402ba514b2f9a2a7d34d;i=557f;    b=fef2848a05ed422b811cda756eea59d6;m=2a5164d50;t=58dde1640752b;  x=4a97c620c9fbf136-0@aa"  
logName:  "projects/finomatic  /logs/cloudsql.googleapis.com%2Fmysql.err"  
receiveTimestamp:  "2019-07-17T10:38:04.977705316Z"  
resource: {…}  
severity:  "INFO"  
textPayload:  "2019-07-17T10:37:59.135897Z 1340 [Note] Aborted  connection 1340 to db: 'finomatic' user: 'root' host: '  cloudsqlproxy~129.41.84.82' (Got an error reading communication packets)"  
timestamp:  "2019-07-17T10:37:59.136950Z"  
}

I am not able to connect to Cloud SQL in GCP, My spring boot application is hosted in Google Kubernetes, I am able to connect my application to database from my local but when I deploy my application image in kubernetes it doesnt work I checked the logs and got this

{
insertId:  "s=5ae000c9c858402ba514b2f9a2a7d34d;i=557f;    b=fef2848a05ed422b811cda756eea59d6;m=2a5164d50;t=58dde1640752b;  x=4a97c620c9fbf136-0@aa"  
logName:  "projects/finomatic  /logs/cloudsql.googleapis.com%2Fmysql.err"  
receiveTimestamp:  "2019-07-17T10:38:04.977705316Z"  
resource: {…}  
severity:  "INFO"  
textPayload:  "2019-07-17T10:37:59.135897Z 1340 [Note] Aborted  connection 1340 to db: 'finomatic' user: 'root' host: '  cloudsqlproxy~129.41.84.82' (Got an error reading communication packets)"  
timestamp:  "2019-07-17T10:37:59.136950Z"  
}

so I added my cluster IP in sql Connection tab, but still getting this error my API works fine when I just preview my app docker image after deployment api doest work getting this error after deploymenet Could not open JPA EntityManager for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection

Harmit Rishi (Cloud Platform Support)

unread,
Jul 17, 2019, 4:13:54 PM7/17/19
to Google Cloud SQL discuss
Hello, 

Thank you for using Google Groups!

As far as Cloud SQL goes, the error message of  Aborted connection nnnn to db:....(Got an error reading communication packets) typically indicates that there is a network issue being experienced or that there are too many connections being made. The following MySQL documentation here provides further details about this. 

As for Cloud SQL, I was able to find this documentation that discusses diagnosing issues with Cloud SQL instances. It mentions that this error message can be seen when your application is not terminating connections properly. This ultimately points to a network issue. You may find details on how to manage your connections for Cloud SQL here

I hope this helps!

Reply all
Reply to author
Forward
0 new messages