0
votes

I am getting the following error while connecting to the MySql instance in google cloud.

The connection to the database is over a private IP.

The same setup is working on a normal co-located server.

I am able to use the mysql client to connect to the database over the private IP.

The application being deployed is a Spring based application.

2020-07-30 09:31:03,369 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (JCA PoolFiller) IJ000610: Unable to fill pool: java:jboss/datasources/ACADEMY: javax.resource.ResourceException: IJ031084: Unable to create connection at [email protected]//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:345) at [email protected]//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:352) at [email protected]//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:287) at [email protected]//org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.createConnectionEventListener(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1322) at [email protected]//org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.fillTo(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1142) at [email protected]//org.jboss.jca.core.connectionmanager.pool.mcp.PoolFiller.run(PoolFiller.java:97) at java.base/java.lang.Thread.run(Thread.java:844) Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at [email protected]//com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) at [email protected]//com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) at [email protected]//com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) at [email protected]//com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:456) at [email protected]//com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) at [email protected]//com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197) at [email protected]//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321) ... 6 more Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

1

1 Answers

0
votes

You need to use the JDBC socket factory. You also need to enable Cloud SQL Admin API in the project, and install / authenticate the Cloud SDK before using the socket factory. Follow the instruction in the link above to add the library as a dependency and to create a JDBC URL