用java连接到ipage数据库

时间:2015-08-11 13:15:29

标签: java mysql

我正在尝试连接到iPage上托管的mysql数据库,这是我的代码

public void addUser(){
    try {
        Class.forName("com.mysql.jdbc.Driver");
        Connection conn = null;
        conn = DriverManager.getConnection("jdbc:mysql://tt.ipagemysql.com","my_user", "password");
        conn.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

但我得到了一个例外

com.mysql.jdbc.exceptions.jdbc4.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.

0 个答案:

没有答案