create SqLite Connection - Java java.sql

Java examples for java.sql:Sqlite

Description

create SqLite Connection

Demo Code


//package com.java2s;

import java.sql.*;

public class Main {
    public static void main(String[] argv) throws Exception {
        createConnection();//  ww  w  .j a  v  a  2  s  . c  om
    }

    static String dbURL = "jdbc:sqlite:c:\\FRCScoutingData\\scoutingData.db";
    static Connection conn = null;

    private static void createConnection() {
        try {
            Class.forName("org.sqlite.JDBC").newInstance();
            //Get a connection
            conn = DriverManager.getConnection(dbURL);
        } catch (Exception except) {
            except.printStackTrace();
        }
    }
}

Related Tutorials