Skip to content

Commit a1e5c05

Browse files
committed
Load Postgres driver if needed
1 parent 1307ef3 commit a1e5c05

File tree

1 file changed

+5
-0
lines changed
  • src/main/java/fi/hsl/transitdata/pulsarpubtransconnect

1 file changed

+5
-0
lines changed

src/main/java/fi/hsl/transitdata/pulsarpubtransconnect/Main.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ private static Connection createPubtransConnection() throws Exception {
146146

147147
Connection connection = null;
148148
try {
149+
if (connectionString.contains("postgresql")) {
150+
//Load Postgres driver
151+
Class.forName("org.postgresql.Driver");
152+
}
153+
149154
connection = DriverManager.getConnection(connectionString);
150155
log.info("Database connection created");
151156
} catch (SQLException e) {

0 commit comments

Comments
 (0)