开发者

Android development with DB => access database via JDBC (SQLWorkbench) or another tool

开发者 https://www.devze.com 2023-03-28 09:52 出处:网络
I develop a little application for android platform. So I use the SQLite开发者_Go百科DB for storing data. Normally (MySQL, Sybase, h2, ...) I can connect to my database via SQLWorkbench. How can I acc

I develop a little application for android platform. So I use the SQLite开发者_Go百科DB for storing data. Normally (MySQL, Sybase, h2, ...) I can connect to my database via SQLWorkbench. How can I access to the database at a real device connected USB - debug mode (maybe with JDBC??)?

I'm searching for an easy way to access "my" SQLiteDB at device for at least viewing the data (it would also be great to manipulate data). Just sending a SQL-Command and get the answer ...

It's unbelievable but I can't find any information for this problem at the internet. If my problem is not described clear enough please ask me. :-)

Tia for you help!


How can I access to the database at a real device connected USB - debug mode (maybe with JDBC??)?

You don't. You have no rights to access the database on production hardware from outside of your application.

One solution is to build a backup/restore feature to your app, and use the backup mechanism to copy the SQLite database file to external storage, where it will be accessible. From there, use any SQLite client you want on the copy in external storage -- I tend to use the SQLite Manager extension for Firefox. If you want, you can also use the built-in sqlite3 command-line client available on most (perhaps all) Android devices.

If you test on the emulator, you can skip the backup-to-external-storage part, as you can access the database more directly. For example, MOTODEV Studio for Android offers live in-Eclipse manipulation of an emulator's database.

0

精彩评论

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