This SQLite Java section teaches you step by step how to interact with SQLite using Java JDBC API.
There are some interfaces that you can use to interact with SQLite using the Java language. Some of these are the native C API wrapper while the other implement the standardized Java Database Connectivity (JDBC) API.
In this section, we will introduce you to a modern JDBC driver which is called SQLiteJDBC package. The SQLiteJDBC package contains both Java classes, as well as native SQLite libraries for Windows, Mac OS X, and Linux.
- Connecting to an SQLite database: this tutorial shows you how to download SQLiteJDBC driver and connect to an existing SQLite database using JDBC.
- Creating a new SQLite database – in this tutorial, we will show you how to create a new SQLite database from a Java program using SQLiteJDBC driver.
- Creating a new table using JDBC – before working with data, you need to create a table. This tutorial shows you how to create a new table in an SQLite database from a Java program.
- Inserting data into a table from a Java program – this tutorial walks you through the steps for inserting data into a table from a Java program
- Querying data from a table with or without parameters – after having the data in the table, we show you how to query data using a SELECT statement. You will learn how to issue a simple
SELECT
statement to query all rows from a table, as well as use a query with parameters to select data based on user’s input. - Updating existing data using PreparedStatement object – this tutorial guides you how to update existing data in a table.
- Deleting data from a table – this tutorial provides the steps for deleting existing data in a table.
- Managing transaction – this tutorial shows you how to manage SQLite transaction using Java JDBC API such as
setAutoCommit
,commit
, androllback
. - Writing and Reading SQLite BLOB – we will show you how to update the SQLite BLOB data into a table and query BLOB data for displaying.