Skip to content

Commit

Permalink
Merge pull request #41998 from Sanne/Felk-oracle_jdbc_23.4
Browse files Browse the repository at this point in the history
Upgrade to Oracle JDBC driver 23.4
  • Loading branch information
Sanne authored Jul 20, 2024
2 parents affc677 + c5c0905 commit 1a31077
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
<mysql-jdbc.version>8.3.0</mysql-jdbc.version>
<mssql-jdbc.version>12.6.3.jre11</mssql-jdbc.version>
<adal4j.version>1.6.7</adal4j.version>
<oracle-jdbc.version>23.3.0.23.09</oracle-jdbc.version>
<oracle-jdbc.version>23.4.0.24.05</oracle-jdbc.version>
<derby-jdbc.version>10.16.1.1</derby-jdbc.version>
<db2-jdbc.version>11.5.8.0</db2-jdbc.version>
<shrinkwrap.version>1.2.6</shrinkwrap.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.pkg.NativeConfig;
import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild;
import io.quarkus.jdbc.oracle.runtime.OracleInitRecorder;

public final class ExtendedCharactersSupport {

@Record(STATIC_INIT)
@BuildStep(onlyIf = NativeOrNativeSourcesBuild.class)
@BuildStep
public void preinitializeCharacterSets(NativeConfig config, OracleInitRecorder recorder) {
recorder.setupCharSets(config.addAllCharsets());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;
import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild;
import io.quarkus.maven.dependency.ArtifactKey;

/**
Expand All @@ -36,7 +35,7 @@
* require it, so this would facilitate the option to revert to the older version in
* case of problems.
*/
@BuildSteps(onlyIf = NativeOrNativeSourcesBuild.class)
@BuildSteps
public final class OracleMetadataOverrides {

static final String DRIVER_JAR_MATCH_REGEX = "com\\.oracle\\.database\\.jdbc";
Expand Down Expand Up @@ -78,15 +77,6 @@ void build(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
.constructors().build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder("oracle.sql.AnyDataFactory")
.constructors().build());
reflectiveClass
.produce(ReflectiveClassBuildItem.builder("com.sun.rowset.providers.RIOptimisticProvider")
.build());
//This is listed in the original metadata, but it doesn't actually exist:
// reflectiveClass.produce(ReflectiveClassBuildItem.builder("oracle.jdbc.logging.annotations.Supports")
// .constructors().methods().build());
//This is listed in the original metadata, but it doesn't actually exist:
// reflectiveClass.produce(ReflectiveClassBuildItem.builder("oracle.jdbc.logging.annotations.Feature")
// .constructors().methods().build());
}

@BuildStep
Expand Down Expand Up @@ -133,6 +123,15 @@ void runtimeInitializeDriver(BuildProducer<RuntimeInitializedClassBuildItem> run
runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.xa.client.OracleXAHeteroConnection"));
runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.driver.T4CXAConnection"));
runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.security.o5logon.O5Logon"));

//These were missing in the original driver, and apparently in its automatic feature definitions as well;
//the need was spotted by running the native build: GraalVM will complain about these types having initialized fields
//referring to various other types which aren't allowed in a captured heap.
runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.diagnostics.Diagnostic"));
runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.replay.driver.FailoverManagerImpl"));
runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.diagnostics.CommonDiagnosable"));
runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.replay.driver.TxnFailoverManagerImpl"));
runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.diagnostics.OracleDiagnosticsMXBean"));
}

@BuildStep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.AdditionalIndexedClassesBuildItem;
import io.quarkus.deployment.builditem.NativeImageFeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;

/**
* @author Sanne Grinovero <sanne@hibernate.org>
*/
public final class OracleNativeImage {

@BuildStep
NativeImageFeatureBuildItem staticNativeImageFeature() {
return new NativeImageFeatureBuildItem("oracle.jdbc.nativeimage.NativeImageFeature");
}

/**
* Registers the {@code oracle.jdbc.driver.OracleDriver} so that it can be loaded
* by reflection, as commonly expected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;

import io.quarkus.runtime.annotations.RegisterForReflection;

@Path("/jpa-oracle/testserialization")
@Produces(MediaType.TEXT_PLAIN)
@RegisterForReflection(targets = { String.class }, serialization = true)
public class SerializationTestEndpoint {

@GET
Expand Down

0 comments on commit 1a31077

Please sign in to comment.