Java Utililty Methods JDBC Sqlite Connection

List of utility methods to do JDBC Sqlite Connection

Description

The list of methods to do JDBC Sqlite Connection are organized into topic(s).

Method

ConnectiongetSQLiteConnection()
get SQ Lite Connection
String fileName = "E:\\Java\\JavaEE\\SimpleWebApp\\WebContent\\sqlite.db";
return getSQLiteConnection(fileName);
ListgetUniqLabels()
get Uniq Labels
Connection c = null;
Statement stmt = null;
List<String> outputs = new ArrayList<String>();
try {
    Class.forName("org.sqlite.JDBC");
    c = DriverManager.getConnection("jdbc:sqlite:dbs/newpress.db");
    c.setAutoCommit(false);
    stmt = c.createStatement();
...
voidmodify(String sql)
modify
Connection conn = getConnection(null);
Statement st = null;
try {
    st = conn.createStatement();
    st.execute(sql);
} catch (Exception e) {
    e.printStackTrace();
} finally {
...
List>query(String sql)
query
List<Map<String, Object>> list = null;
Connection conn = getConnection(null);
Statement st = null;
ResultSet rs = null;
if (conn != null) {
    try {
        st = conn.createStatement();
        rs = st.executeQuery(sql);
...
voidremoveLabel()
remove Label
Connection c = null;
Statement stmt = null;
try {
    Class.forName("org.sqlite.JDBC");
    c = DriverManager.getConnection("jdbc:sqlite:dbs/newpress.db");
    c.setAutoCommit(true);
    stmt = c.createStatement();
    stmt.executeUpdate("DELETE from DOC_LABEL;");
...
voidrunSetupScript(final String setupScriptPath)
Load and run a SQL script.
if (!checkConnection())
    return; 
final boolean isSqlite = (dbURL.startsWith("jdbc:sqlite:"));
FileReader fr = new FileReader(setupScriptPath);
BufferedReader br = new BufferedReader(fr);
List<String> sqls = new ArrayList<String>();
try {
    StringBuilder sb = new StringBuilder();
...