From bbcf1d00711bbce6a51084bc41c5e872f95f91e8 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 6 Oct 2023 22:12:37 -0500 Subject: [PATCH] Fix abstractDhRepo on Forge --- .../distanthorizons/core/sql/AbstractDhRepo.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/sql/AbstractDhRepo.java b/core/src/main/java/com/seibel/distanthorizons/core/sql/AbstractDhRepo.java index f89c00d4f..207c04ede 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/sql/AbstractDhRepo.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/sql/AbstractDhRepo.java @@ -61,6 +61,18 @@ public abstract class AbstractDhRepo this.databaseLocation = databaseLocation; this.dtoClass = dtoClass; + + try + { + // needed by Forge to load the Java database connection + Class.forName("org.sqlite.JDBC"); + } + catch (ClassNotFoundException e) + { + throw new RuntimeException(e); + } + + // get or create the connection, // reusing existing connections reduces the chance of locking the database during trivial queries this.connectionString = this.databaseType+":"+this.databaseLocation;