3

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?

p.campbell
  • 98,673
  • 67
  • 256
  • 322
mayur rahatekar
  • 4,410
  • 12
  • 37
  • 51

4 Answers4

8

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

Pete Houston
  • 14,931
  • 6
  • 47
  • 60
2

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à!
Barmaley
  • 16,638
  • 18
  • 73
  • 146
  • Thanks a lot for your reply. I have SQlite on my system. But how to put MDB data to the SQL lite database. Whether I have to write a progrm in android which will take my data from MDB and put into SQLite database. I dont know how to connect MDB to my android application. Can we use MDB inside the android application. – mayur rahatekar Oct 05 '11 at 06:15
1

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/

EmoRoid
  • 11
  • 2
0

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

Slider
  • 134
  • 7
  • That would be useful if I didn't have to be familiar with compiling to get it to run on my 65bit Win 10 computer. The .exe does not work. – cyclingLinguist Jul 30 '21 at 00:55
  • 1
    Try to download Microsoft Visual C++ Redistributable for Visual Studio e.g.: https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0 – Slider Jul 31 '21 at 23:08