Opens a SQLite database file @param file The path to the SQLite database file @return The Connection to this SQLite database
(Path file)
| 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 |
no test coverage detected