Skip to content

Commit e0302c0

Browse files
yrodieregsmet
authored andcommitted
Document why loadDriversInTCCL is necessary
(cherry picked from commit ac251a6)
1 parent b6672e7 commit e0302c0

File tree

1 file changed

+7
-1
lines changed
  • extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime

1 file changed

+7
-1
lines changed

extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,13 @@ public boolean isValid(Connection connection) {
367367

368368
/**
369369
* Uses the {@link ServiceLoader#load(Class) ServiceLoader to load the JDBC drivers} in context
370-
* of the current {@link Thread#getContextClassLoader() TCCL}
370+
* of the current {@link Thread#getContextClassLoader() TCCL}.
371+
* <p>
372+
* This is necessary to have JDBC URLs work properly, in particular when using custom drivers,
373+
* and in particular when the app gets "restarted" in a single system (?) classloader,
374+
* because DriverManager's list of available drivers would get cleared on shutdown.
375+
* <p>
376+
* See also https://github.com/quarkusio/quarkus/issues/46324#issuecomment-2687615191
371377
*/
372378
private static void loadDriversInTCCL() {
373379
// load JDBC drivers in the current TCCL

0 commit comments

Comments
 (0)