Java SQLite Tutorial

In this tutorial you will learn about Java SQLite.

SQLite is lightweight, zero configuration, serverless SQL database library. In this tutorial I will teach you how to use SQLite database with Java.

Note: I have made this tutorial using Eclipse. Because it is easier to import library in an IDE.

First off all you need to download the SQLite JDBC library or jar. Download it from below link.


Now just import it into your project. If you don’t know how to import library in Eclipse then follow below link.

Java SQLite Tutorial

Java SQLite Tutorial

Connection with Database

Below example shows how you can connect Java with SQLite database. Here demo.db is the database name, you can change it according to you. If the database doesn’t exists then it will be created.


On successful connection the program show output “Connection established” otherwise “Some error occurred”.


Java SQLite Example

The below program first establish connection with SQLite database, create a table, insert some record in it and then finally display the records. This shows that how you can work with SQLite using Java.



Java SQLite Tutorial Output

So this was the simple Java SQLite tutorial. You can comment below if you are facing any problem.

2 thoughts on “Java SQLite Tutorial”

  1. If one creates and runs the programs on this page in sequence, the second program will fail because it tries to create “test.db” but finds it already there. It would be better to change the name of the first one so that the sample programs will work as intended.

    It would be useful for people like me who have never quite figured out the Unix way of handling pathnames to give an example of how output could be directed to, e.g., the same directory that contains the Java program.

    Thanks for the good tutorial.

Leave a Comment

Your email address will not be published. Required fields are marked *