load the mysql driver in android emulator

不想你离开。 提交于 2020-01-07 03:57:12

问题


how to load the mysql server in android emulator

i.e Class.forName("com.mysql.jdbc.Driver")

i got the exception java.land.ClassNotFoundException in com.mysql.jdbc.Drive

please reply me.


回答1:


This assumes MySQL is publicly available from internet, but it is never good idea .

Setup public WebService and connect to it from mobile application.




回答2:


You won't be able to run MySQL server on an Android device.

What you're doing, however, is trying to load the MySQL client library. That isn't included as part of Android so you cannot load it. You'd need to include the relevant JARs in your project, if you really do want to connect to a remote MySQL database from an Android app.

If you do want to store and access data on your Android device, the awesome SQLite database is included by default, including all the APIs you need to create, upgrade and otherwise interact with SQLite databases.




回答3:


When I did this I created PHP files for the database operations. I sent data in XML and received data in XML all using PHP scripts. I found this to be the easiest way for me...but you need to know PHP of course.



来源:https://stackoverflow.com/questions/2235951/load-the-mysql-driver-in-android-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!