views:

2938

answers:

3

How to get the MySQL database connection in android emulator? I try to connect using java.sql.* package like this

I get the exception: java.sql.SQLException:no suitable drive

How can I use sql packages in android mobile?

+3  A: 

As I wrote a few minutes ago:

Never never never use a database driver across an Internet connection, for any database, for any platform, for any client, anywhere. That goes double for mobile. Database drivers are designed for LAN operations and are not designed for flaky/intermittent connections or high latency.

CommonsWare
ok thanks. do u know how to get the value from mysql database using web service an android mobile. please give some example.
saravanan
To access REST Web services from Android, I recommend HttpClient -- you can find sample code on the Apache HttpClient site (http://hc.apache.org).
CommonsWare
A: 

The way I got around this was writing all the server side code in PHP and inventing my own XML schema for sending and receiving data. You just use POST or GET and send using the default HTTP classes that come with android. You can then translate the response XML from the PHP page to do what you want by using one of the three XML parsers that come with android.

jax
thanks, do u have any samples for android.
saravanan
A: 

You would not typically want to connect directly to a database over the web on your mobile device.

Instead of connecting directly to a database over the web you might look at creating an interface for whatever data it is you want to access and exposing it as a service:

  1. SOAP (ksoap2 )
  2. REST

Then you can use Java APIs to access your data.

Layne