Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of DB2 XA Driver ends up with error com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.29.24] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError #22711

Closed
bvahdat opened this issue Jan 7, 2022 · 18 comments
Labels
area/jdbc Issues related to the JDBC extensions env/windows Impacts Windows machines kind/bug Something isn't working

Comments

@bvahdat
Copy link

bvahdat commented Jan 7, 2022

Describe the bug

Running on a Windows 10 64-bit using Quarkus 2.6.1.Final following the relevant dependencies I have for connecting to a DB2 instance:

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-agroal</artifactId>
</dependency>
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-jdbc-db2</artifactId>
</dependency>
<dependency>
    <groupId>com.ibm.db2.jcc</groupId>
    <artifactId>db2jcc_license_cisuz</artifactId>
    <version>11.1</version>
</dependency>

The settings in application.properties are as the folloiwng:

%prod.quarkus.datasource.P82DataSource.db-kind=${P82_KIND:db2}
%prod.quarkus.datasource.P82DataSource.jdbc.url=${P82_URL}
%prod.quarkus.datasource.P82DataSource.username=${P82_USER}
%prod.quarkus.datasource.P82DataSource.password=${P82_PASS}

The value of P82_URL is jdbc:db2://<IP_ADDRESS>:446/<DATABASE_NAME>.

The application runs without any issue using this setup as one can see below (both in JVM as well as native mode):

...
2022-01-07 04:24:42,704 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 3.14.0 (camel-1) started in 401ms (build:0ms init:385ms start:16ms)
2022-01-07 04:24:42,820 INFO  [io.quarkus] (main) my-app 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.6.1.Final) started in 2.211s. Listening on: http://0.0.0.0:8080
2022-01-07 04:24:42,820 INFO  [io.quarkus] (main) Profile prod activated.
2022-01-07 04:24:42,820 INFO  [io.quarkus] (main) Installed features: [agroal, artemis-jms, camel-core, camel-direct, camel-jms, camel-jta, camel-log, camel-micrometer, camel-microprofile-health, camel-xpath, camel-xslt, cdi, jdbc-db2, jdbc-h2, micrometer, narayana-jta, smallrye-context-propagation, smallrye-health, vertx]
...

Now if I ask for the XA driver using:

%prod.quarkus.datasource.P82DataSource.jdbc.transactions=xa

Then the application fails to load the XA driver with the following message on startup:

2022-01-07 04:25:51,916 WARN  [io.agr.pool] (main) Datasource 'P82DataSource': Ignoring property 'URL': No setter in class com.ibm.db2.jcc.DB2XADataSource
2022-01-07 04:25:51,916 WARN  [io.agr.pool] (main) Datasource 'P82DataSource': Ignoring property 'URL': No setter in class com.ibm.db2.jcc.DB2XADataSource
...
...
2022-01-07 04:25:52,918 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 3.14.0 (camel-1) started in 432ms (build:0ms init:400ms start:32ms)
2022-01-07 04:25:53,013 INFO  [io.quarkus] (main) my-app 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.6.1.Final) started in 1.946s. Listening on: http://0.0.0.0:8080
2022-01-07 04:25:53,013 INFO  [io.quarkus] (main) Profile prod activated.
2022-01-07 04:25:53,013 INFO  [io.quarkus] (main) Installed features: [agroal, artemis-jms, camel-core, camel-direct, camel-jms, camel-jta, camel-log, camel-micrometer, camel-microprofile-health, camel-xpath, camel-xslt, cdi, jdbc-db2, jdbc-h2, micrometer, narayana-jta, smallrye-context-propagation, smallrye-health, vertx]
com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.29.24] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\IBM\SQLLIB\BIN\db2jcct2.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform:  ERRORCODE=-4472, SQLSTATE=null
        at com.ibm.db2.jcc.am.b7.a(b7.java:794)
        at com.ibm.db2.jcc.am.b7.a(b7.java:66)
        at com.ibm.db2.jcc.am.b7.a(b7.java:107)
        at com.ibm.db2.jcc.t2.a.a(a.java:37)
        at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(T2Configuration.java:95)
        at com.ibm.db2.jcc.DB2BaseDataSource.instantiateLogWriter(DB2BaseDataSource.java:12359)
        at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12271)
        at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12224)
        at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:159)
        at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:134)
        at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.29.24] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\IBM\SQLLIB\BIN\db2jcct2.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform:  ERRORCODE=-4472, SQLSTATE=null
        at com.ibm.db2.jcc.am.b7.a(b7.java:794)
        at com.ibm.db2.jcc.am.b7.a(b7.java:66)
        at com.ibm.db2.jcc.am.b7.a(b7.java:107)
        at com.ibm.db2.jcc.t2.a.a(a.java:37)
        at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(T2Configuration.java:95)
        at com.ibm.db2.jcc.DB2BaseDataSource.instantiateLogWriter(DB2BaseDataSource.java:12359)
        at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12271)
        at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12224)
        at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:159)
        at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:134)
        at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
...

The file C:\Program Files (x86)\IBM\SQLLIB\BIN\db2jcct2.dll is existing on the machine. I have also WSL on the same machine. Again using plain JDBC driver works perfectly but switching to XA driver results in a similar error:

2022-01-07 04:28:52,993 WARN  [io.agr.pool] (main) Datasource 'P82DataSource': Ignoring property 'URL': No setter in class com.ibm.db2.jcc.DB2XADataSource
2022-01-07 04:28:52,993 WARN  [io.agr.pool] (main) Datasource 'P82DataSource': Ignoring property 'URL': No setter in class com.ibm.db2.jcc.DB2XADataSource
...
...
2022-01-07 04:28:53,759 INFO  [io.quarkus] (main) my-app 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.6.1.Final) started in 1.632s. Listening on: http://0.0.0.0:8080
2022-01-07 04:28:53,760 INFO  [io.quarkus] (main) Profile prod activated.
2022-01-07 04:28:53,760 INFO  [io.quarkus] (main) Installed features: [agroal, artemis-jms, camel-core, camel-direct, camel-jms, camel-jta, camel-log, camel-micrometer, camel-microprofile-health, camel-xpath, camel-xslt, cdi, jdbc-db2, jdbc-h2, micrometer, narayana-jta, smallrye-context-propagation, smallrye-health, vertx]
com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.29.24] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: no db2jcct2 in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib:  ERRORCODE=-4472, SQLSTATE=null
        at com.ibm.db2.jcc.am.b7.a(b7.java:794)
        at com.ibm.db2.jcc.am.b7.a(b7.java:66)
        at com.ibm.db2.jcc.am.b7.a(b7.java:107)
        at com.ibm.db2.jcc.t2.a.a(a.java:37)
        at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(T2Configuration.java:95)
        at com.ibm.db2.jcc.DB2BaseDataSource.instantiateLogWriter(DB2BaseDataSource.java:12359)
        at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12271)
        at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12224)
        at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:159)
        at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:134)
        at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.29.24] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: no db2jcct2 in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib:  ERRORCODE=-4472, SQLSTATE=null
        at com.ibm.db2.jcc.am.b7.a(b7.java:794)
        at com.ibm.db2.jcc.am.b7.a(b7.java:66)
        at com.ibm.db2.jcc.am.b7.a(b7.java:107)
        at com.ibm.db2.jcc.t2.a.a(a.java:37)
        at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(T2Configuration.java:95)
        at com.ibm.db2.jcc.DB2BaseDataSource.instantiateLogWriter(DB2BaseDataSource.java:12359)
        at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12271)
        at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12224)
        at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:159)
        at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:134)
        at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
...

The warning message at the very first begining seems to be from:
https://github.com/agroal/agroal/blob/master/agroal-pool/src/main/java/io/agroal/pool/util/PropertyInjector.java#L46

Any help is much appreciated.

cc: @gsmet @barreiro @aguibert

Expected behavior

I expect to see the XA Driver usage works the same as the JDBC driver.

Actual behavior

The usage of XA Driver fails.

How to Reproduce?

No response

Output of uname -a or ver

MINGW64_NT-10.0-18363 XYZ 3.1.7-340.x86_64 2021-10-12 16:29 UTC x86_64 Msys

Output of java -version

openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05) OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.6.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: C:\Develop\apache-maven-3.8.4 Java version: 17.0.1, vendor: GraalVM Community, runtime: C:\Develop\graalvm-17 Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Additional information

No response

@bvahdat bvahdat added the kind/bug Something isn't working label Jan 7, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jan 7, 2022

/cc @mswatosh

@quarkus-bot quarkus-bot bot added area/persistence OBSOLETE, DO NOT USE env/windows Impacts Windows machines labels Jan 7, 2022
@gsmet
Copy link
Member

gsmet commented Jan 7, 2022

When you're enabling XA, is it failing in native only or both in native and JVM?

@bvahdat
Copy link
Author

bvahdat commented Jan 7, 2022

Thanks @gsmet for your support and sorry for not mentioning that point already. It fails with the same error as mentioned above both in the native and JVM modes. The error message in native mode though reads a bit different:

Caused by: com.ibm.db2.jcc.am.SqlException: [jcc]Missing resource bundle: A resource bundle could not be found in the com.ibm.db2.jcc package for IBM Data Server Driver for JDBC and SQLJ ERRORCODE=-4472, SQLSTATE=null

But as you see with the same values: ERRORCODE=-4472, SQLSTATE=null

@gsmet
Copy link
Member

gsmet commented Jan 7, 2022

The resource bundle issue will be a different issue that is native specific.

@barreiro could you enlighten us on how Agroal is supposed to work with DB2 + XA? I'm not sure to understand why it tries to inject the URL in it.

@yasserzamani
Copy link

I'm not sure to understand why it tries to inject the URL in it.

Because the Quarkus application has following in application.properties I think:
%prod.quarkus.datasource.P82DataSource.jdbc.url=${P82_URL}
but DB2 XADataSource class doesn't have such setter, consequently you'll see those warns above by Agroal.

So we also tried both

%prod.quarkus.datasource.P82DataSource.serverName=<IP_ADDRESS>
%prod.quarkus.datasource.P82DataSource.portNumber=446
%prod.quarkus.datasource.P82DataSource.databaseName=<DATABASE_NAME>

and

%prod.quarkus.datasource.P82DataSource.jdbc.serverName=<IP_ADDRESS>
%prod.quarkus.datasource.P82DataSource.jdbc.portNumber=446
%prod.quarkus.datasource.P82DataSource.jdbc.databaseName=<DATABASE_NAME>

but this time Quarkus itself warns that it's ignoring them because it doesn't know them. It doesn't pass them to Agroal :(

@barreiro
Copy link
Contributor

@yasserzamani you'll have to use quarkus.datasource.jdbc.additional-jdbc-properties to inject those settings.

That will be:

%prod.quarkus.datasource.P82DataSource.jdbc.additional-jdbc-properties.serverName=<IP_ADDRESS>
%prod.quarkus.datasource.P82DataSource.jdbc.additional-jdbc-properties.portNumber=446
%prod.quarkus.datasource.P82DataSource.jdbc.additional-jdbc-properties.databaseName=<DATABASE_NAME>

@yasserzamani
Copy link

Thanks a lot @barreiro yes it worked

@gsmet
Copy link
Member

gsmet commented Jan 11, 2022

@barreiro should we document it?

@bvahdat
Copy link
Author

bvahdat commented Jan 11, 2022

@yasserzamani you'll have to use quarkus.datasource.jdbc.additional-jdbc-properties to inject those settings.

That will be:

%prod.quarkus.datasource.P82DataSource.jdbc.additional-jdbc-properties.serverName=<IP_ADDRESS>
%prod.quarkus.datasource.P82DataSource.jdbc.additional-jdbc-properties.portNumber=446
%prod.quarkus.datasource.P82DataSource.jdbc.additional-jdbc-properties.databaseName=<DATABASE_NAME>

Additionaly we had to set the driver type as well to make it work:

%prod.quarkus.datasource.P82DataSource.jdbc.additional-jdbc-properties.driverType=4

And I think the other issue is still the resource bundle problem to make it work natively as well. I used GraalVM agent to find out what else is still missing:

https://www.graalvm.org/reference-manual/native-image/Agent/

See the attachment in case it should be of any help, and thanks for all your support so far.

missings.txt

@bvahdat
Copy link
Author

bvahdat commented Jan 11, 2022

And just to emphasize the point that with applying those changes above (missings.txt) I was able to successfully run in native mode without any error.

@bvahdat
Copy link
Author

bvahdat commented Jan 28, 2022

@gsmet @barreiro

Now that the oracle extension works I gave it a try and now I am stuck in a similar error we used to have with DB2 by this ticket.

Similar to the DB2 setup above following my setup for Oracle:

<dependency>
   <groupId>io.quarkus</groupId>
   <artifactId>quarkus-jdbc-oracle</artifactId>
</dependency>
%prod.quarkus.datasource.EAIDB.db-kind=oracle
%prod.quarkus.datasource.EAIDB.jdbc.transactions=xa
%prod.quarkus.datasource.EAIDB.jdbc.url=${EAIDB_URL}
%prod.quarkus.datasource.EAIDB.username=${EAIDB_USER}
%prod.quarkus.datasource.EAIDB.password=${EAIDB_PASS}

With this setup I get:

2022-01-28 11:12:59,825 WARN  [org.apa.cam.com.jms.EndpointMessageListener] (Camel (camel-1) thread #3 - JmsConsumer[marktdepot/steuerverfahren/steuerverfahren-kista-daska-sourceadaptor/create-request-job-queue]) Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL]: org.apache.camel.RuntimeCamelException: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
       at org.apache.camel.component.jms.EndpointMessageListener$EndpointMessageListenerAsyncCallback.done(EndpointMessageListener.java:217)
       at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:136)
       at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:736)
       at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:696)
       at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:674)
       at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:318)
       at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:245)
       at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1237)
       at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1227)
       at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1120)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
       at java.lang.Thread.run(Thread.java:833)
       at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
       at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
Caused by: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
       at oracle.jdbc.datasource.impl.OracleDataSource.makeURL(OracleDataSource.java:1294)
       at oracle.jdbc.datasource.impl.OracleDataSource.getURL(OracleDataSource.java:1066)
       at oracle.jdbc.xa.client.OracleXADataSource.getPooledConnection(OracleXADataSource.java:362)
       at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:233)
       at oracle.jdbc.xa.client.OracleXADataSource.getXAConnectionInternal(OracleXADataSource.java:281)
       at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:174)
       at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:146)
       at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
       at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
       at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
       at java.util.concurrent.FutureTask.run(FutureTask.java:264)
       at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)

I looked into the decompiled code of oracle.jdbc.datasource.impl.OracleDataSource and made the conclusion that driverType needs to be set as well, so I also added:

%prod.quarkus.datasource.EAIDB.jdbc.additional-jdbc-properties.driverType=thin

And with that I now get an additional warning for the EAIDB datasource at startup with the same Oracle error as before:

2022-01-28 10:35:04,731 WARN  [io.agr.pool] (main) Datasource 'EAIDB': Ignoring property 'URL': No setter in class oracle.jdbc.xa.client.OracleXADataSource
2022-01-28 10:35:04,733 WARN  [io.agr.pool] (main) Datasource 'EAIDB': Ignoring property 'driverType': No setter in class oracle.jdbc.xa.client.OracleXADataSource
2022-01-28 10:35:04,734 WARN  [io.agr.pool] (main) Datasource 'EAIDB': Available properties []
2022-01-28 10:35:04,734 WARN  [io.agr.pool] (main) Datasource 'EAIDB': Ignoring property 'URL': No setter in class oracle.jdbc.xa.client.OracleXADataSource
2022-01-28 10:35:04,734 WARN  [io.agr.pool] (main) Datasource 'EAIDB': Ignoring property 'driverType': No setter in class oracle.jdbc.xa.client.OracleXADataSource
2022-01-28 10:35:04,734 WARN  [io.agr.pool] (main) Datasource 'EAIDB': Available properties []
2022-01-28 10:35:04,740 WARN  [io.agr.pool] (main) Datasource 'P82DataSource': Ignoring property 'URL': No setter in class com.ibm.db2.jcc.DB2XADataSource
2022-01-28 10:35:04,740 WARN  [io.agr.pool] (main) Datasource 'P82DataSource': Ignoring property 'URL': No setter in class com.ibm.db2.jcc.DB2XADataSource

But as far as I see there is a public void setDriverType(String driverType) setter method there. Any idea what I am missing here? And the same question about the URL setter method. Both DB2 & Oracle datasource implementations do provide a setter for URL so why do we get those warnings the same as for the driverType property?

@bvahdat
Copy link
Author

bvahdat commented Jan 28, 2022

@gsmet @barreiro
Ah and just to be precise, it all works in JVM-mode. The problem here is native mode.

@Sanne
Copy link
Member

Sanne commented Jan 31, 2022

hi @bvahdat , could you open a new issue for the Oracle XA problem and attach a reproducer please? Ideally one without Camel as that would help me a lot :)
Thanks

@gsmet
Copy link
Member

gsmet commented Jan 31, 2022

@Sanne from what I have seen, I think we will need adapters to properly instantiate the XA datasources.

@bvahdat
Copy link
Author

bvahdat commented Feb 1, 2022

hi @bvahdat , could you open a new issue for the Oracle XA problem and attach a reproducer please? Ideally one without Camel as that would help me a lot :) Thanks

Hi @Sanne thanks for your great support, really appreciating. You can find the reproducer here.

@Sanne
Copy link
Member

Sanne commented Feb 10, 2022

Back to this issue, reading the original stacktrace one can see this error reported as the cause: Can't load IA 32-bit .dll on a AMD 64-bit platform: ERRORCODE=-4472, SQLSTATE=null

I don't have a Windows machine but a quick search finds this article:

https://www.ibm.com/support/pages/failure-loading-native-library-db2jcct2-unsatisfiedlinkerror-errorcode-4472

Could it be you've installed the wrong version of the driver?

@bvahdat
Copy link
Author

bvahdat commented Feb 12, 2022

Back to this issue, reading the original stacktrace one can see this error reported as the cause: Can't load IA 32-bit .dll on a AMD 64-bit platform: ERRORCODE=-4472, SQLSTATE=null

I don't have a Windows machine but a quick search finds this article:

https://www.ibm.com/support/pages/failure-loading-native-library-db2jcct2-unsatisfiedlinkerror-errorcode-4472

Could it be you've installed the wrong version of the driver?

Thanks @Sanne for the follow up. At our end it all works as expected, see also this comment. So to summarize with the following setup and adjustments (according to missings.txt attachment above) we were able to successfully make use of the DB2 XA Driver with SSL:

%prod.quarkus.datasource.P82DataSource.db-kind=db2
%prod.quarkus.datasource.P82DataSource.jdbc.url=${P82_URL}
%prod.quarkus.datasource.P82DataSource.jdbc.additional-jdbc-properties.databaseName=${P82_DATABASE_NAME}
%prod.quarkus.datasource.P82DataSource.jdbc.additional-jdbc-properties.driverType=4
%prod.quarkus.datasource.P82DataSource.jdbc.additional-jdbc-properties.portNumber=${P82_PORT}
%prod.quarkus.datasource.P82DataSource.jdbc.additional-jdbc-properties.serverName=${P82_SERVER_NAME}
%prod.quarkus.datasource.P82DataSource.jdbc.additional-jdbc-properties.sslConnection=${P82_SSL_ENABLED:false}
%prod.quarkus.datasource.P82DataSource.jdbc.transactions=xa
%prod.quarkus.datasource.P82DataSource.username=${P82_USER}
%prod.quarkus.datasource.P82DataSource.password=${P82_PASS}

So I think at the Quarkus project side, we need some extra documentation about this as well as adjustments to the DB2 extension itself, so that bits given through missings.txt under the folder src/main/resources/META-INF/native-image becomes unnecessary.

@yrodiere yrodiere added area/jdbc Issues related to the JDBC extensions and removed area/persistence OBSOLETE, DO NOT USE labels Aug 13, 2024
@gastaldi
Copy link
Contributor

Closing as it seems to be working now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/jdbc Issues related to the JDBC extensions env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants