How to convert MDB to SQLite in Android

為{幸葍}努か 提交于 2020-01-19 13:06:39

问题


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 SQLite?


回答1:


You can write your own - it's not very difficult

  1. Install SQlite on your desktop - just go to sqlite.org
  2. Get JDBC access to SQLite (there're a lot of JDBC drivers for SQLite)
  3. Get JDBC access to your MDB (MS-Access) using JDBC (common JDBC-ODBC bridge driver is ok)
  4. Voilà!



回答2:


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




回答3:


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/




回答4:


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



来源:https://stackoverflow.com/questions/7657115/how-to-convert-mdb-to-sqlite-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!