How to use SQLite on Linux with database on SD card

I need to develop an application using SQLite in Linux environment. All the records / data should be stored in SDcard. I’m planning to use VF61 + Viola for production environment. Requesting your support.
-Thanks in Advance.

SQLite uses a file with .db extension as the database. Where you would like to keep this database file is as per your requirements. On our modules, SD cards are mounted under the /media path. Assuming SD card gets mounted at the path /media/sda1, specifying this path to sqlite3_open will make the database file reside on the SD card. Any further operation you carry out on the database file handle would result in the data being stored in this database file on SD card.

Please refer the SQLite documentation for further details.

You might also want to refer the excellent “The Definitive Guide to SQLite by Mike Owens”.

Also for your information please be aware of consequences of carrying out extensive write operations to the NAND flash in case the database file is made to reside on NAND flash. You might want to refer the following discussion.

The database will do much IO in flash?

If you do not how to use a database on a network, I recommend using separate database on the microSD and the system in the eMMC.