Topic
  • 8 replies
  • Latest Post - ‏2013-09-09T03:36:02Z by U4UE_xie_zhi
Ricardo Herrmann
Ricardo Herrmann
2 Posts

Pinned topic Using JDBC 4.0 driver for XML data type

‏2012-05-04T05:12:02Z |
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:

java.lang.AbstractMethodError: java/sql/ResultSet.getSQLXML(I)Ljava/sql/SQLXML;

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.

Thoughts?

Thanks in advance.
Updated on 2013-03-04T07:53:15Z at 2013-03-04T07:53:15Z by SystemAdmin
  • X75J_Li_Yanli
    X75J_Li_Yanli
    45 Posts

    Re: Using JDBC 4.0 driver for XML data type

    ‏2012-05-08T07:47:48Z  
    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.
  • X75J_Li_Yanli
    X75J_Li_Yanli
    45 Posts

    Re: Using JDBC 4.0 driver for XML data type

    ‏2012-05-08T07:53:29Z  
    By the way, what version of was ce are you using?
  • Ricardo Herrmann
    Ricardo Herrmann
    2 Posts

    Re: Using JDBC 4.0 driver for XML data type

    ‏2012-05-08T21:00:44Z  
    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.
    Platform: DB2 Express-C 10.1, Websphere CE 3.0.0.1

    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!
  • X75J_Li_Yanli
    X75J_Li_Yanli
    45 Posts

    Re: Using JDBC 4.0 driver for XML data type

    ‏2012-05-14T05:16:19Z  
    Platform: DB2 Express-C 10.1, Websphere CE 3.0.0.1

    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!
    Hello,

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

    Attachments

  • X75J_Li_Yanli
    X75J_Li_Yanli
    45 Posts

    Re: Using JDBC 4.0 driver for XML data type

    ‏2012-05-14T05:57:24Z  
    Platform: DB2 Express-C 10.1, Websphere CE 3.0.0.1

    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!
    Also attached the jar of db2 express-c installation folder.

    Attachments

  • X75J_Li_Yanli
    X75J_Li_Yanli
    45 Posts

    Re: Using JDBC 4.0 driver for XML data type

    ‏2012-05-14T06:39:37Z  
    Platform: DB2 Express-C 10.1, Websphere CE 3.0.0.1

    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!
    Hello,

    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
    SystemAdmin
    2233 Posts

    Re: Using JDBC 4.0 driver for XML data type

    ‏2013-03-04T07:53:15Z  
    I'm running into the exact same issue with:
    WASCE 3.0.0.3 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:

    java.lang.AbstractMethodError: java/sql/Statement.isClosed()Z
    at com.ibm.rdf.store.internal.jena.impl.DB2ResultSetImpl.internalMoveNext (Unknown Source)
    at com.ibm.rdf.store.internal.jena.impl.DB2ResultSetImpl.hasNext (Unknown Source)
    at nl.netage.db2test.DB2Test.doGet(DB2Test.java:108)

    This seems inline with:
    https://issues.apache.org/jira/browse/GERONIMO-6138

    I talked to some DB2 folks and they confirmed the graphstore component needs JDBC4

    Any update on this would be highly appreciated.
  • U4UE_xie_zhi
    U4UE_xie_zhi
    54 Posts

    Re: Using JDBC 4.0 driver for XML data type

    ‏2013-09-09T03:36:02Z  
    I'm running into the exact same issue with:
    WASCE 3.0.0.3 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:

    java.lang.AbstractMethodError: java/sql/Statement.isClosed()Z
    at com.ibm.rdf.store.internal.jena.impl.DB2ResultSetImpl.internalMoveNext (Unknown Source)
    at com.ibm.rdf.store.internal.jena.impl.DB2ResultSetImpl.hasNext (Unknown Source)
    at nl.netage.db2test.DB2Test.doGet(DB2Test.java:108)

    This seems inline with:
    https://issues.apache.org/jira/browse/GERONIMO-6138

    I talked to some DB2 folks and they confirmed the graphstore component needs JDBC4

    Any update on this would be highly appreciated.

    suggest you to upgrade to wasce3.0.0.4. It supports JDBC4.