【求解】android利用JDBC直接调用MYSQL问题

最近正在忙活着毕业设计,关于android上的图书管理系统。系统大概是编写一个android的手机客户端,然后利用JDBC直接连接同一局域网的mysql数据库服务器来访问数据。
现在客户端做好了,后台数据库也运行了并且在eclipse上面测试过,利用一个JAVA测试通过JDBC访问mysql成功,但在客户端运行的时候就是死活无法连接。。。附上客户端的连接代码:

public class DBUtil 
{
    public static Connection getConnection()
{
Connection con=null;
try
{   
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://172.71.103.44:3306/test?useUnicode=true&characterEncoding=UTF-8","root","1234");           
}
catch(Exception e)
{
e.printStackTrace();
}
return con;
}

androidmysql连接JDBC

既然你有个后台数据库 并且可以在网络上被访问 感觉这本身就是不好的 有以下几点:

1.数据库可能不够安全;
2.浪费了服务器的资源;

所以我给你一个建议:

服务器提供操作数据库的api;

则样子做的好处就是跨平台开发很方便 不用每个平台都去做直接操作服务器数据库的事 你只需要发送一些http请求即可操作服务器的数据库了

请楼主参考一下下面链接给的内容……如果楼主牛叉,可以自己写一个android的mysql驱动。广大的开源爱好者会非常的感谢您的付出……

CSDN移动问答

android手机客户端与你数据库不在同一个平台上,android不支持用jdbc来连接mysql的,可以用个webservice来做数据的交互。

http://zhidao.baidu.com/question/509083545.html

楼主你好,我参照了我的代码发现你并没有把连接实例化,你运行后连接不上是报异常还是没有反应呢?
Class.forName(Driver).newInstance();
Connection con=DriverManager.getConnection(URL,Username,Password);
这两段是我连接新浪云数据库实现的代码,连接没有问题已经发布。
希望能帮到你,欢迎追问。

为啥我的一直报这个错误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.,求大神回复
为啥我的一直报这个错误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.,求大神回复