【发布时间】:2014-04-19 22:45:00
【问题描述】:
我正在尝试使用我的 mysql 数据库连接到我的 android 设备,我可以在本地(从仿真设备)进行,但是当我使用我的 IP 连接到我的手机时,我得到:
Communication Link failure
The last packet send succesfully to the server was 0 millisecond ago. The driver has not recived any packet from the server
我的代码是:
Class.forName("com.mysql.jdbc.Driver");
Connection conn=DriverManager.getConnection("jdbc:mysql://MYIP:3306/BD", "USER", "USER");
使用本地主机它可以工作:
Connection conn=DriverManager.getConnection("jdbc:mysql://10.0.2.2:3306/BD", "USER", "USER");
感谢您的帮助。
【问题讨论】:
-
您的手机是否与您的计算机连接到同一个网络?