MCPcopy Create free account
hub / github.com/boxbeam/RedLib / openSQLite

Method openSQLite

src/redempt/redlib/sql/SQLHelper.java:28–41  ·  view source on GitHub ↗

Opens a SQLite database file @param file The path to the SQLite database file @return The Connection to this SQLite database

(Path file)

Source from the content-addressed store, hash-verified

26 * @return The Connection to this SQLite database
27 */
28 public static Connection openSQLite(Path file) {
29 try {
30 Class.forName("org.sqlite.JDBC");
31
32 final Properties properties = new Properties();
33 properties.setProperty("foreign_keys", "on");
34 properties.setProperty("busy_timeout", "1000");
35
36 return DriverManager.getConnection("jdbc:sqlite:" + file.toAbsolutePath(), properties);
37 } catch (ClassNotFoundException | SQLException e) {
38 sneakyThrow(e);
39 return null;
40 }
41 }
42
43 /**
44 * Opens a connection to a MySQL database

Callers 1

SQLiteBackendMethod · 0.95

Calls 2

sneakyThrowMethod · 0.95
getConnectionMethod · 0.80

Tested by

no test coverage detected