Skip to content

Commit

Permalink
fix: bring back driver registration (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcosentino11 authored Nov 14, 2023
1 parent df6b7b9 commit b380f8d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/com/aws/greengrass/disk/spool/DiskSpoolDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public DiskSpoolDAO(NucleusPaths paths) throws IOException {
* @throws SQLException if database is unable to be created
*/
public void initialize() throws SQLException {
registerDriver();
try (LockScope ls = LockScope.lock(connectionLock.writeLock())) {
close();
connection = createConnection();
Expand All @@ -116,6 +117,16 @@ public void initialize() throws SQLException {
}
}

private void registerDriver() throws SQLException {
try {
// driver is registered statically within JDBC,
// so it will only happen once
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException e) {
throw new SQLException("unable to load driver", e);
}
}

/**
* Close any open DAO resources, including database connections.
*/
Expand Down

0 comments on commit b380f8d

Please sign in to comment.