Use SQLite with Java

In order to use SQLite 3 with Java, you need to do the following steps on your Linux or Windows box. I have deliberately kept off specific commands.

  1. Install SQLite3 from your Linux distribution repository. You can also download the Windows edition if you use Windows.
  2. Visit and download the JDBC driver. I downloaded the sqlite-jdbc-3.7.2.jar file as that was the latest one available for download.
  3. Copy it to your project’s folder.
  4. Install libsqliteodbc onto your computer.
  5. Now, you can try to use the library in your SQLite3 JDBC programs to connect to SQLite databases.
  6. Try to key in the sample java program on the xerial page to see if it worked.

The key advantage of using SQLite3 is that it is light, simple and good for small projects. It is also the main database tool in-built on an Android phone. For larger projects, you should use MySQL or PostgreSQL or even Java’s Derby. Maybe if you have the budget, Oracle or others.

You can also refer to this link for a great book on using SQLite and JDBC.