From 709d922baffce413f6b369492c105500c6b92c6f Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Wed, 15 Dec 2021 16:48:51 +0000 Subject: [PATCH] Oracle JDBC: to not enforce runtime initializaiton for java.sql.DriverManager --- .../jdbc/oracle/deployment/OracleMetadataOverrides.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java b/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java index 08a0fc7090e89..fc80e9c76cb75 100644 --- a/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java +++ b/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java @@ -69,7 +69,13 @@ void runtimeInitializeDriver(BuildProducer run //These re-implement all the "--initialize-at-build-time" arguments found in the native-image.properties : runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.OracleDriver")); runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.driver.OracleDriver")); - runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("java.sql.DriverManager")); + + // The Oracle driver's metadata hints to require java.sql.DriverManager to be initialized at runtime, but: + // A) I disagree with the fact that a driver makes changes outside of its scope (java.sql in this case) + // B) It does actually not compile if you have other JDBC drivers, as other implementations need this class initialized during build + // C) This metadata is expected to get improved in the next public release of the Oracle JDBC driver + // runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("java.sql.DriverManager")); + runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.driver.LogicalConnection")); runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.pool.OraclePooledConnection")); runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.pool.OracleDataSource"));