How to convert MDB to SQLite in Android
I have one Microsoft Access .MDB file and want to use that database in an Android application.
How can I convert the .mdb database to SQ开发者_Go百科Lite?
You need to use some tools to convert database, refer to supported list softwares that do the job you need here: http://www.sqlite.org/cvstrac/wiki?p=ConverterTools
You can write your own - it's not very difficult
- Install SQlite on your desktop - just go to sqlite.org
- Get JDBC access to SQLite (there're a lot of JDBC drivers for SQLite)
- Get JDBC access to your MDB (MS-Access) using JDBC (common JDBC-ODBC bridge driver is ok)
- Voilà!
Steps to read Access files in android :
1-Creat Acces Database then,Export the access database into text files, semicolon or comma delimited. 2-Open the SQLite database browser version 1.1 ( http://sourceforge.net/projects/sqlitebrowser/files/sqlitebrowser/1.1/sqlitebrowser-1.1-win.zip/download?use_mirror=garr&download= ) and chose creat new DATABASE then enter it's name ,then file menu ->import->table from csv file. Browse for your text file and choose the proper delimiter. Click create. 3-Done.
Then you would need to make some modifications to that database and those tables to make it usable by Android to populate listviews and other widgets.
1) The database must contain a table called "android_metadata" 2) This table must have the column "locale" 3) There should be a single record in the table with a value of "en_US" 4) The primary key for every table needs to be called "_id" (this is so Android will know where to bind the id field of your tables) Then you put the DB in your assets folder and when your app starts copy it to your apps data directory.
Now : Using your own SQLite database in Android applications example here: http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
Another excellent tool to convert the .mdb database to SQLite: https://github.com/arturasn/mdb2sqlite
Executable direct download: https://github.com/arturasn/mdb2sqlite/blob/master/bin/mdb2sqlite.exe
精彩评论