Connect to sqlite database - Java JDBC

Java examples for JDBC:Sqlite

Description

Connect to sqlite database

Demo Code

import java.sql.*;

public class SQLiteJDBC{

    public static void main(String args[]){
        Connection c = null;// www . ja  va 2 s .co  m
        try{
            Class.forName( "org.sqlite.JDBC");
            c = DriverManager.getConnection("jdbc:sqlite:test.db");
        } catch(Exception e){
            System.err.println(e.getClass().getName() + ": " + e.getMessage());
            System.exit(0);
        }
        System.out.println("Opened database successfully");
    }
}

Related Tutorials