How do I force a particular version of the JDBC driver in a datasource? I registered the db2jcc4 JAR from DB2 Express-C 10.1 in the repository and selected this when creating the XA data source, but it still uses an older version, which leads to the following error when I try to get a value from a XML column in the result set:
This happens because this is only implemented in JDBC 4.0. From another error message I could see clearly that the driver in use currently is 3.50.152.
Thanks in advance.
Ricardo Herrmann 270002XFCP
Pinned topic Using JDBC 4.0 driver for XML data type
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-03-04T07:53:15Z at 2013-03-04T07:53:15Z by SystemAdmin
Re: Using JDBC 4.0 driver for XML data type2012-05-08T07:47:48ZThis is the accepted answer. This is the accepted answer.Hello,
Which version of db2 are you using?
I tried like this according to your info:
1. Using db2 9.7 and create a database
2. Create a table including one column which type is XML and insert some data
3. Create a new database pool using websphere ce database pool wizard which under admin console-->Datasources:
"database type" : DB2 XA
"Driver JAR": using server's:com.ibm.db2/db2jcc/9.5-bundle/jar
4. Access the table of step2 and works well without any problem
5. I also tried to install the jdbc driver of ibm_data_server_driver_for_jdbc_sqlj_v10.1
6. Create a database pool and access to the table of step2, works well
Could you please let me know how you find the version of jdbc driver and please support some info that can help me reproduce this problem.
Ricardo Herrmann 270002XFCP2 Posts
Re: Using JDBC 4.0 driver for XML data type2012-05-08T21:00:44ZThis is the accepted answer. This is the accepted answer.
- X75J_Li_Yanli 270003X75J
The JDBC4 driver that comes with DB2 Express-C is version 4.13.127
An easy way to reproduce it:
1) In the WAS console, open the Repository Viewer
2) At the Add Archive to Repository section, click Browse
3) Select the DB2 JDBC4 driver from $DB2_HOME/java/db2jcc4.jar
4) Check "Specify other parts" and fill the form with Group: com.ibm.db2, Artifact: db2jcc4, Version: 10.1, Type: jar
5) Click install
6) Open the Datasources (Database Pools) application
7) Create a new database pool using the pool wizard
8) Give it a name like jdbc/SampleDS, with database type DB2 XA
9) Click Next
10) In the Driver Jar you'll see "com.ibm.db2/db2jcc4/10.1/jar, select this one
11) Fill in the database name, user credentials, host and port
12) Make sure the Driver Type is set to 4
13) Click Deploy
14) In the Run SQL section, using the newly created datasource, run a bogus query like "blah"
15) There will be an error, and expanding it reveals that the driver in use is version 3.50.152
The weird thing though, which is seemingly unrelated (since the interface for JDBC comes from java.sql), is that from the original error message (in the first post), it looks like the ResultSet.getSQLXML(int) method doesn't have the method, but I'm using J9 VM 1.6, /opt/ibm/java-i386-60/jre/lib/sql.jar is in the class path and opening it shows that the method is there in the interface.
No findings until now, but I'll give it another try later.
Thanks for helping!
Re: Using JDBC 4.0 driver for XML data type2012-05-14T05:16:19ZThis is the accepted answer. This is the accepted answer.
I tried the steps as yours and server works well without any problem.
1.I installed the db2 express-c 10.1 on linux
2.Create a database named TEST1
3.Install the jdbc driver via repository in admin console
4.Create a database pool using the pool wizard,give it a name like jdbc/TEST1, with database type DB2 XA,choose "com.ibm.db2/db2jcc4/10.1/jar" as the driver,fill in the database name, user credentials, host and port, also set the value:
5. Use the created datasource to create table and do some query, all works well.
6. Please check your sql and make sure it is right and I also attached the ibm_data_server_driver_for_jdbc_sqlj_v10.1: db2jcc4.jar that I downloaded from IBM info center.
Re: Using JDBC 4.0 driver for XML data type2012-05-14T05:57:24ZThis is the accepted answer. This is the accepted answer.
Re: Using JDBC 4.0 driver for XML data type2012-05-14T06:39:37ZThis is the accepted answer. This is the accepted answer.
If still have problem, please attach your log info: server.log and server.out.
And attach the information using the command when server is in running status :
collector --user myadmin --password mypassword
under <wasce_home>/bin directory.
SystemAdmin 110000D4XK2233 Posts
Re: Using JDBC 4.0 driver for XML data type2013-03-04T07:53:15ZThis is the accepted answer. This is the accepted answer.I'm running into the exact same issue with:
WASCE 188.8.131.52 Build:2012.09.11-16:34:25.432+0800
JVM: 1.7.0 Java Vendor: IBM Corporation
DB2 V10.1 FP2
I'm trying to use the graphstore component of DB2, but that relies on JDBC4 on execution I run in into:
at com.ibm.rdf.store.internal.jena.impl.DB2ResultSetImpl.internalMoveNext (Unknown Source)
at com.ibm.rdf.store.internal.jena.impl.DB2ResultSetImpl.hasNext (Unknown Source)
This seems inline with:
I talked to some DB2 folks and they confirmed the graphstore component needs JDBC4
Any update on this would be highly appreciated.