I have a Java/Jetty based appengine project that successfully connects to 
Google cloud MySql server when using TCP connection with JDBC, BUT fails to 
connect to the same server when trying to make it through Instance name and 
JDBC socketFactory. 
the error I am getting in the GCP debug console:
"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."

try {
    Class.forName("com.mysql.jdbc.GoogleDriver");
    String url= String.format("jdbc:google:mysql:///"
    + "MY_DB_NAME" + "?"
    + "cloudSqlInstance=%s&"
    + "socketFactory=%s&"
    + "useSSL=false",
    "PROJECT-ID:ZONE:INSTANCE_NAME", 
                        "com.google.cloud.sql.mysql.SocketFactory");
    
    return DriverManager.getConnection(url, USER_NAME, USER_PASSWORD);
    } catch (SQLException | ClassNotFoundException e) {
    e.printStackTrace();
    return null;
    }



-- 
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/52b9af89-f6f6-4acf-8e02-1163b0026287%40googlegroups.com.

Reply via email to