我正在尝试连接到MYSQL
托管在MAMP Pro
. 我正在尝试使用 java 和VBA
. VBA
连接正常但java在几秒钟后给了我错误
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.
上Java
String userName = "user";
String password = "pass";
String url = "jdbc:mysql://10.0.1.1/datab";
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
conn = DriverManager.getConnection (url, userName, password);
上VBA
Sub ConnectToDatabase()
Set oConn = New ADODB.Connection
oConn.Open "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=10.0.1.1;" & _
"DATABASE=datab;" & _
"USER=user;" & _
"PASSWORD=pass;" & _
"PORT=3306;" & _
"Option=3"
End Sub
telnet 10.0.1.1 3306
接受来自客户端机器的连接。我的绑定地址是服务器 IPmy.conf
I'm using mysql-connector-java 5.1.18