diff --git a/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java b/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java index eb719e72ac136..b8dd019dbe556 100644 --- a/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java +++ b/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java @@ -1,12 +1,9 @@ package io.quarkus.agroal.runtime; import java.sql.Connection; -import java.sql.Driver; import java.sql.Statement; import java.util.Collection; -import java.util.Iterator; import java.util.Map; -import java.util.ServiceLoader; import java.util.Set; import java.util.stream.Collectors; @@ -157,9 +154,6 @@ public AgroalDataSource createDataSource(String dataSourceName) { "Datasource " + dataSourceName + " does not have a JDBC URL and should not be created"); } - // we first make sure that all available JDBC drivers are loaded in the current TCCL - loadDriversInTCCL(); - AgroalDataSourceSupport.Entry matchingSupportEntry = agroalDataSourceSupport.entries.get(dataSourceName); String resolvedDriverClass = matchingSupportEntry.resolvedDriverClass; Class driver; @@ -354,21 +348,4 @@ public boolean isValid(Connection connection) { poolConfiguration.flushOnClose(dataSourceJdbcRuntimeConfig.flushOnClose()); } - /** - * Uses the {@link ServiceLoader#load(Class) ServiceLoader to load the JDBC drivers} in context - * of the current {@link Thread#getContextClassLoader() TCCL} - */ - private static void loadDriversInTCCL() { - // load JDBC drivers in the current TCCL - final ServiceLoader drivers = ServiceLoader.load(Driver.class); - final Iterator iterator = drivers.iterator(); - while (iterator.hasNext()) { - try { - // load the driver - iterator.next(); - } catch (Throwable t) { - // ignore - } - } - } }