简体   繁体   English

AppEngine 在尝试连接到 Google Cloud MySql 实例时出现“通信链路故障”错误

[英]AppEngine gets “Communication link failure” error while trying to connect to Google Cloud MySql instance

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. 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:我在 GCP 调试控制台中遇到的错误:

"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." “通信链路故障最后一个成功发送到服务器的数据包是 0 毫秒前。>驱动程序没有收到来自服务器的任何数据包。”

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;
        }

The problem might be in the public IP address that you specify in the cloud mysql instance.问题可能出在您在云 mysql 实例中指定的公共 IP 地址中。 Just check the public IP address by typing What is my public IP?只需通过键入我的公共 IP 是什么来检查公共 IP 地址即可? in the browser.在浏览器中。 Then update the public IP given for the google cloud instance.然后更新为谷歌云实例提供的公共 IP。 This might be help to solve your issue.这可能有助于解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 2台笔记本电脑上的mysql通信链接失败 - mysql communication link failure on 2 laptops Class 未找到? com.google.cloud.sql.mysql.SocketFactory 尝试连接到云 ZAC5C74B64B4B835AFFBAZ2EF2FAC281 - Class Not Found? com.google.cloud.sql.mysql.SocketFactory while trying to connect to cloud sql 无法使用 JDBC 连接到在 Docker 上运行的 MySQL 服务器 - 通信链接失败 - cannot connect to MySQL-server running on Docker with JDBC - Communication Link Failure 通信链接失败(MYSQL SERVER 8 + JAVA) - Communication Link Failure (MYSQL SERVER 8 + JAVA) Java MySQL JDBC通信链接失败 - Java MySQL JDBC Communication link failure mysql jdbc 驱动中通信链路故障 - Communication link failure in mysql jdbc driver 通信链路故障:Spring开机、MySQL、Docker - Communication link failure: Spring boot, MySQL, Docker 在Java Appengine开发过程中使用Google Cloud SQL(而不是本地MySQL实例) - Using Google Cloud SQL during Java appengine development (instead of local MySQL instance) java 连接到 mysql 数据库抛出错误(通信链路故障) - java connect to a mysql database throws error(communications link failure) 群集故障转移后连接到Aurora-Mysql时出现通信链接故障 - Getting communication Link failure while connecting to Aurora-Mysql after cluster failover
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM