我做使用JDBC将数据发送到数据库中,而无需使用任何Web服务的Android应用程序。我没有采用Android 2.2模拟器一个实验,我能够将数据发送到MySQL数据库(本地)。从那以后,我尝试过采用Android 2.2设备发送,我改变了路径,从
的jdbc:mysql的://10.0.2.2:3306 /
与的jdbc:mysql的://xx.xx.xx.xx:3306 /
。
XX.XX.XX.XX距离 IPCONFIG
我的本地机器。但它不工作的设备。可能是什么原因。
主要疑虑:
请Android设备目前支持JDBC? 在将Android 2.2支持JDBC? 如果支持,它的Android版本将支持JDBC? 解决方案是的。你一定记得把你的JDBC连接code在的AsyncTask
,
否则,你会燃烧BURN刻录!
I am doing an Android application using JDBC to send data to database without using any web services. I did an experiment using Android 2.2 emulator and I am able to send data to MySQL DB (LOCALHOST). After that I tried to send using Android 2.2 device, I changed the path from
jdbc:mysql://10.0.2.2:3306/
with jdbc:mysql://xx.xx.xx.xx:3306/
.
xx.xx.xx.xx is from ipconfig
of my localhost machine. But it is not working in the device. What could be the reason.
Main doubts:
Do Android devices currently support JDBC? Will Android 2.2 support JDBC? If supported, which Android versions will support JDBC?解决方案
Yes. You must remember to put your JDBC connection code in an AsyncTask
,
otherwise you will BURN BURN BURN!