DB2 - Problem description
Problem IC65851 | Status: Closed |
RECEIVE JAVA.LANG.NULLPOINTEREXCEPTION WHEN ACCESSING VALUE OF CURSOR TYPED OUTPUT PARAMETER RETURNED BY A SQL CALL STATEMENT | |
product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problem description: | |
You receive a java.lang.NullPointer exception from com.ibm.db2.jcc.am.vm.getObject when attempting to get the value of a cursor typed output parameter returned by an SQL Call statement, and literal values were used for at least one input parameter. Example Create Procedure DDL: CREATE PROCEDURE P1(IN V1 INTEGER, OUT CV1 CURSOR) BEGIN SET CV1 = CURSOR FOR VALUES(V1); END Example Java Code: The example assumes that the conn variable represents an instance of the Connection class with an open connection to a database where the procedure P1 has been defined. CallableStatement cstmt = conn.prepareCall("CALL P1(42, ?"); cstmt.registerOutParameter(1, com.ibm.db2.jcc.DB2Types.CURSOR); cstmt.execute(); ResultSet rs = (ResultSet)cstmt.getObject(1); <-- Throws java.lang.NullPointerException Exception Call Stack: java.lang.NullPointerException at com.ibm.db2.jcc.am.gc.a(gc.java:1822) at com.ibm.db2.jcc.am.vm.A(vm.java:1039) at com.ibm.db2.jcc.am.vm.getObject(vm.java:1017) | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * Java applications using JCC Type 4 Driver against DB2 forLUW * * 9.7 server. * **************************************************************** * PROBLEM DESCRIPTION: * * You receive a java.lang.NullPointer exception * * fromcom.ibm.db2.jcc.am.vm.getObject when attempting to get * * thevalue of a cursor typed output parameter returned by an * * SQLCall statement and literal values were used for at least * * oneinput parameter.Example Create Procedure DDL:CREATE * * PROCEDURE P1(IN V1 INTEGER, OUT CV1 CURSOR)BEGINSET CV1 = * * CURSOR FOR VALUES(V1);ENDExample Java Code:The example * * assumes that the conn variable represents aninstance of the * * Connection class with an open connection toa database where * * the procedure P1 has been defined.CallableStatement cstmt = * * conn.prepareCall("CALL P1(42, * * ?");cstmt.registerOutParameter(1,com.ibm.db2.jcc.DB2Types.CURS * rs = (ResultSet)cstmt.getObject(1); <-- * * Throwsjava.lang.NullPointerExceptionException Call * * Stack:java.lang.NullPointerExceptionat * * com.ibm.db2.jcc.am.gc.a(gc.java:1822)at * * com.ibm.db2.jcc.am.vm.A(vm.java:1039)at * * com.ibm.db2.jcc.am.vm.getObject(vm.java:1017) * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 for LUW version 9.7 Fix Pack 2. * **************************************************************** | |
Local Fix: | |
available fix packs: | |
DB2 Version 9.7 Fix Pack 2 for Linux, UNIX, and Windows | |
Solution | |
Problem was first fixed in Version 9.7 Fix Pack 2. This fix should be applied on the server. You will no longer receive a java.lang.NullPointer exception from com.ibm.db2.jcc.am.vm.getObject when retrieving the value of a Cursor typed output parameter from an SQL Call statement. | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 26.01.2010 05.07.2010 05.07.2010 |
Problem solved at the following versions (IBM BugInfos) | |
9.7.FP2 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.7.0.2 |