开发者

how to get mysql database connection in android emulator

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?


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜