diff --git a/src/main/java/com/aws/greengrass/disk/spool/DiskSpoolDAO.java b/src/main/java/com/aws/greengrass/disk/spool/DiskSpoolDAO.java index fdc99a2..fc99aa2 100644 --- a/src/main/java/com/aws/greengrass/disk/spool/DiskSpoolDAO.java +++ b/src/main/java/com/aws/greengrass/disk/spool/DiskSpoolDAO.java @@ -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(); @@ -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. */