views:

645

answers:

3

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.

+2  A: 

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.

Christopher
ok thanks. how to connect a remote mysql database from an android application. please give me the solution.
saravanan
Preferably you'd use a web service of some description, but otherwise you would do it like I mentioned above: include the MySQL driver JAR in your Android project and use the `java.sql` packages as usual.
Christopher
+3  A: 

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

Setup public WebService and connect to it from mobile application.

noonex
A: 

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.

jax