I'm having a spring application with maven. I want to communicate with a cloud SQL MySQL database I have in GCP asynchronously.
I tried following the getting started code and wrote this:
Connection connection = MySQLConnectionBuilder
.createConnectionPool(
"jdbc:mysql://google/$DB_NAME
?socketFactory=com.google.cloud.sql.mysql.SocketFactory
&cloudSqlInstance=$PROJECT_ID:$PROJECT_LOCATION:$INSTANCE_NAME"
);
CompletableFuture<QueryResult> future = connection.sendPreparedStatement("select * from TABLE_NAME");
return future;
However,I keep getting this error:
io.netty.channel.ConnectTimeoutException: connection timed out
Can someone please help me out here?