Firstly, since connecting using TCP connection with JDBC is not supported on App Engine Standard[1], I assume your application is in an App Engine flexible environment.
>From the snippet of your code shared, I really do not see anything wrong with your implementation, it seems no different from the sample code shared on this page[2--See the Java section]. As you may already know, there are quite a number of reasons why a Communications link failure would be returned from a DB, which includes running out of memory resource and wrong information about the DB. This Stackoverflow thread[3] discusses different possibilities, keeping in mind that CloudSQL is only a Google-Managed mySQL product. For better troubleshooting of the issue, which may involve reviewing configurations on your Project, I recommend you contact the GCP Support Engineers[4] or if you think this issue is a bug and you are using the appropriate User account but it is failing, then open an issue using this link[5]. [1]https://cloud.google.com/sql/docs/mysql/connect-app-engine#standard [2]https://cloud.google.com/sql/docs/mysql/connect-app-engine#connecting_to [3]https://stackoverflow.com/questions/2983248/com-mysql-jdbc-exceptions-jdbc4-communicationsexception-communications-link-fai [4]https://cloud.google.com/support-hub [5]https://developers.google.com/issue-tracker/#public_users -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/ffe8325a-a0ea-49e1-b495-532c7aebe877%40googlegroups.com.