Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to port an existing MS Access to SQLite for use with android app developement? [duplicate]

Possible Duplicate:
How to convert MDB to SQLite in Android

I have an MS access database with few tables and quite a bit of data in it. I was wondering if it is possible for me to port all those tables over to sqlite for an android app that I am developing.

Thanks for your time

like image 802
Madhu Avatar asked Jun 18 '12 16:06

Madhu


People also ask

Can MS Access Connect to SQLite?

In Microsoft Access, you can connect to your SQLite data either by importing it or creating a table that links to the data. Devart ODBC drivers support all modern versions of Access.


1 Answers

The easiest way would be to export each table to CSV and then use an SQLite tool of some sort to import those tables into your SQLite database. I use SQLite Expert.

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.

A good link for this copying process is here.

You could also use SQLiteAssetHelper to handle the transfer of the DB from assets to your data directory instead of doing the way the tutorial shows if you felt the need.

like image 143
Barak Avatar answered Oct 05 '22 23:10

Barak