Java JDBC Sqlite Connection getSQLiteConnection()

Here you can find the source of getSQLiteConnection()

Description

get SQ Lite Connection

License

Open Source License

Declaration

public static Connection getSQLiteConnection() throws ClassNotFoundException, SQLException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Main {
    public static Connection getSQLiteConnection() throws ClassNotFoundException, SQLException {

        String fileName = "E:\\Java\\JavaEE\\SimpleWebApp\\WebContent\\sqlite.db";
        return getSQLiteConnection(fileName);
    }//from   w  w w  .  j  a v  a2  s . c  o  m

    public static Connection getSQLiteConnection(String fileName) throws SQLException, ClassNotFoundException {

        // Declare the class Driver for SQLite DB
        Class.forName("org.sqlite.JDBC");

        // URL Connection for SQLite
        // Example: jdbc:sqlite:file_sqlite.db
        String connectionURL = "jdbc:sqlite:" + fileName;

        Connection conn = DriverManager.getConnection(connectionURL);
        return conn;
    }
}

Related

  1. getConnection(String dbFile)
  2. getConnection(String dbFilePath)
  3. getConnection(String dbName)
  4. getNewConnection(File dbFile)
  5. getSenatorProp(String topicId)
  6. getUniqLabels()
  7. modify(String sql)
  8. query(String sql)
  9. removeLabel()