Wiki
Clone wikisqlite4java / GettingStarted
Getting Started
- Grab the latest build from the downloads. The file is named
sqlite4java-NNN.zip
, where NNN is the svn repository version used to build the library. - The file contains:
sqlite4java.jar
- place it on your CLASSPATH;- Native libraries (
*.dll, *.so, *.jnilib
) - place them in the same directory withsqlite4java.jar
; sqlite4java-src.zip
- Java sources, add this file as the library sources in your IDE;sqlite4java-docs.zip
- javadocs for the reference (see also javadocs online).
- Run
java -jar sqlite4java.jar
to see the version of the library, the version of SQLite and compile-time options. This also verifies that native library loads normally on your platform. - Get acquainted with classes SQLiteConnection and SQLiteStatement. Here's a short code sample:
SQLiteConnection db = new SQLiteConnection(new File("/tmp/database")); db.open(true); ... SQLiteStatement st = db.prepare("SELECT order_id FROM orders WHERE quantity >= ?"); try { st.bind(1, minimumQuantity); while (st.step()) { orders.add(st.columnLong(0)); } } finally { st.dispose(); } ... db.dispose();
- If you're doing a GUI application, create a separate thread for running SQLite and organize job queue.
Updated