Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ dependencies {
compile 'com.zaxxer:HikariCP:5.0.1'
compile 'org.slf4j:slf4j-api:1.7.36'
compile 'com.ibm.db2.jcc:db2jcc:db2jcc4'
compile 'org.hsqldb:hsqldb:2.5.0'
compile 'org.mariadb.jdbc:mariadb-java-client:2.6.0'
compile 'com.microsoft.sqlserver:mssql-jdbc:8.2.2.jre11'
compile 'com.oracle.database.jdbc:ojdbc8:19.6.0.0'
compile 'org.postgresql:postgresql:42.2.25'
compile 'com.sap.cloud.db.jdbc:ngdbc:2.4.76'
compile 'org.hsqldb:hsqldb:2.6.1'
compile 'org.mariadb.jdbc:mariadb-java-client:2.7.5'
compile 'com.microsoft.sqlserver:mssql-jdbc:9.4.0.jre11'
compile 'com.oracle.database.jdbc:ojdbc8:21.5.0.0'
compile 'org.postgresql:postgresql:42.3.3'
compile 'com.sap.cloud.db.jdbc:ngdbc:2.11.17'

// UnitTesting
compile group: 'junit', name: 'junit', version: '4.11'
Expand Down
23 changes: 17 additions & 6 deletions javasource/databaseconnector/impl/JdbcConnectionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -61,19 +63,28 @@ public Connection getConnection(final String jdbcUrl, final String userName, fin
/**
* The JDBC drivers in the userlib folder of a project are not automatically
* correctly registered to the DriverManager. The cause is maybe the fact that
* the drivers are put into the project.jar on deployment. Iterating through the
* drivers found by ServiceLoader.load(Driver.class) will force them to load and
* register to the DriverManager.
* the drivers are put into the project.jar on deployment. Hence, we explicitly
* register the drivers.
*/
private synchronized void initializeDrivers() {
if (!hasDriversInitialized) {
ServiceLoader<Driver> loader = ServiceLoader.load(Driver.class);
List<Driver> drivers = StreamSupport.stream(loader.spliterator(), false).collect(Collectors.toList());

for (Driver driver : drivers) {
try {
DriverManager.registerDriver(driver);
} catch (SQLException e) {
throw new RuntimeException("Failed to register JDBC driver: " + driver.getClass().getName(), e);
}
}

if (logNode.isTraceEnabled()) {
Stream<String> driverNames = StreamSupport.stream(loader.spliterator(), false)
.map(a -> a.getClass().getName());
String logMessage = driverNames.collect(Collectors.joining(", ", "Found JDBC Drivers: ", ""));
String logMessage = drivers.stream().map(a -> a.getClass().getName())
.collect(Collectors.joining(", ", "Found JDBC Drivers: ", ""));
logNode.trace(logMessage);
}

hasDriversInitialized = true;
}
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file removed userlib/com.oracle.database.ha.ons-19.6.0.0.jar
Binary file not shown.
Binary file added userlib/com.oracle.database.ha.ons-21.5.0.0.jar
Binary file not shown.
Binary file not shown.
Binary file removed userlib/com.oracle.database.jdbc.ojdbc8-19.6.0.0.jar
Binary file not shown.
Binary file not shown.
Binary file removed userlib/com.oracle.database.jdbc.ucp-19.6.0.0.jar
Binary file not shown.
Binary file added userlib/com.oracle.database.jdbc.ucp-21.5.0.0.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added userlib/com.sap.cloud.db.jdbc.ngdbc-2.11.17.jar
Binary file not shown.
Binary file removed userlib/com.sap.cloud.db.jdbc.ngdbc-2.4.76.jar
Binary file not shown.
Binary file removed userlib/org.hsqldb.hsqldb-2.5.0.jar
Binary file not shown.
Binary file added userlib/org.hsqldb.hsqldb-2.6.1.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.