List of utility methods to do JDBC Sqlite Connection
boolean | checkConnection() Checks if connection is supposed to be present and attempts to reconnect if there was previously an error. if (connection != null) { try { return (!errorCondition) || connect(userName, password, null); } catch (IOException ioe) { return false; return false; ... |
void | createTable(final String databaseName, final String statement) create Table Connection c = null; Statement stmt = null; try { c = DriverManager.getConnection("jdbc:sqlite:" + databaseName + ".db"); System.out.println("Opened database successfully"); stmt = c.createStatement(); stmt.executeUpdate(statement); stmt.close(); ... |
void | createTable(String database, String sqlScript) create Table Connection c = null; Statement stmt = null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:" + database); stmt = c.createStatement(); stmt.executeUpdate(sqlScript); stmt.close(); ... |
Connection | getConnection() get Connection try { Class.forName("org.sqlite.JDBC"); } catch (ClassNotFoundException e) { e.printStackTrace(); System.exit(-1); Connection connection = DriverManager.getConnection("jdbc:sqlite:test.db", "", ""); connection.setAutoCommit(false); ... |
Connection | getConnection(final String databaseName) get Connection sb.setLength(0);
sb.append(JDBC_PREFIX).append(databaseName).append(DB_SUFFIX);
Connection conn = null;
conn = DriverManager.getConnection(sb.toString());
sb.setLength(0);
return conn;
|
Connection | getConnection(String dbFile) get Connection try { Class.forName("org.sqlite.JDBC"); } catch (ClassNotFoundException e) { throw new RuntimeException(e); Properties connectionProps = new Properties(); connectionProps.setProperty("flags", "READONLY"); Connection connection = DriverManager.getConnection("jdbc:sqlite:" + new File(dbFile).toURI().getPath(), ... |
Connection | getConnection(String dbFilePath) get Connection Connection conn = null; try { if (dbFilePath == null || "".equals(dbFilePath.trim())) { dbFilePath = default_db_name; Class.forName("org.sqlite.JDBC"); conn = DriverManager.getConnection("jdbc:sqlite:" + dbFilePath); } catch (Exception e) { ... |
Connection | getConnection(String dbName) get Connection if (mConn == null) { try { Class.forName(mdbDriver); String connDbName = mdbName; if (dbName != null) { connDbName = dbName; mConn = DriverManager.getConnection(mdbUrl + connDbName, mdbUser, mdbPwd); ... |
Connection | getNewConnection(File dbFile) get New Connection Connection c; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:" + dbFile.getAbsolutePath()); return c; } catch (Exception e) { return null; |
TreeMap | getSenatorProp(String topicId) get Senator Prop Connection c = null; Statement stmt = null; TreeMap<String, Double> output = new TreeMap<String, Double>(); try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:dbs/newpress.db"); c.setAutoCommit(false); System.out.println("Opened database successfully"); ... |