Pinned topicUsing JDBC 4.0 driver for XML data type

‏2012-05-04T05:12:02Z
|Tags:

Answered question
This question has been answered.

Unanswered question
This question has not been answered yet.

Hello,

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:

Re: Using JDBC 4.0 driver for XML data type

‏2012-05-08T07:47:48Z

This 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.

Re: Using JDBC 4.0 driver for XML data type

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.

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.

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.

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:
<single-pool>
<max-size>10</max-size>
<min-size>0</min-size>
<blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
<idle-timeout-minutes>15</idle-timeout-minutes>
<match-one/>
</single-pool>
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.

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.

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.

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.