我正在使用mysql-connector-java-5.1.38,它在localhost上工作得很好。但是当我在openshift上连接到我的数据库时,我遇到了麻烦:
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.
这是我连接服务器的代码:
public static final String DATABASE = "jdbc:mysql://<database address>:3306/my_database";
public static final String DB_ACCOUNT = "my_userame";
public static final String DB_PASSWORD = "my_password";
...
connection = DriverManager.getConnection(DATABASE, DB_ACCOUNT, DB_PASSWORD);
请帮帮我。非常感谢你!