I am trying to convert an existing Android, SQLite database to a multi-platform, SQLite database in order to create a prototype of a larger project that can be tested on Windows without relying on Android. The existing Android classes that were being imported into Eclipse (using Java) included:
- Context
- Cursor
- SQLException
- SQLiteDatabase
- SQLiteStatement
So far, I found that SQLException in Android is very similar to the class in the java.sql library (also called SQLException). I also downloaded and included the sqlite4java.jar file, which includes the SQLiteStatement class. In this jar file, it also has SQLiteConnection, which represents a single connection to a SQLite database. However, I am unable to find comparable, non-Android, classes for Cursor and Context. Does anyone know of a solution?
The main call for Cursor is as follows:
Cursor cursor = db.query(true, table, columns, selection, selectionArgs, null, null, null, null);
where ‘db’ used to be a SQLiteDatabase. I changed ‘db’ to be a SQLiteConnection, but that has no query() function, so I have run into another problem.
NOTE: I have also looked at org.tmatesoft.sqljet and org.sqlite packages, but could not find anything useful.
Thank you in advance for your help.
I’ve used SQLiteJDBC from Zentus. Once the project is configured according to the docs, just use standard the JDBC API.
I’ve also heard good things about a derivative of Zentus’s library by Xerial, also called SQLiteJDBC, but I’ve never used it.