Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bring back driver registration #37

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading