Download Sqlitejdbc372jar Install Instant
Create and run a simple test program to confirm the driver is accessible:
import java.sql.*;public class SQLiteTest public static void main(String[] args) try // Load driver (not always required in modern JDBC but safe) Class.forName("org.sqlite.JDBC");
// Test connection (creates in-memory database) Connection conn = DriverManager.getConnection("jdbc:sqlite::memory:"); System.out.println("SQLite JDBC Driver successfully installed and loaded!"); System.out.println("SQLite version: " + conn.getMetaData().getDatabaseProductVersion()); conn.close(); catch (Exception e) System.err.println("Installation verification failed: " + e.getMessage());
Expected output:
SQLite JDBC Driver successfully installed and loaded!
SQLite version: 3.72.0 (or similar) download sqlitejdbc372jar install
import java.sql.*;public class SQLiteTest public static void main(String[] args) String url = "jdbc:sqlite:my_database.db";
try (Connection conn = DriverManager.getConnection(url); Statement stmt = conn.createStatement()) // Create table stmt.execute("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)"); // Insert stmt.execute("INSERT INTO users (name) VALUES ('Alice')"); // Query ResultSet rs = stmt.executeQuery("SELECT * FROM users"); while (rs.next()) System.out.println(rs.getInt("id") + ": " + rs.getString("name")); catch (SQLException e) e.printStackTrace();
Add to your build.gradle:
dependencies
implementation 'org.xerial:sqlite-jdbc:3.72.0'