Bug #16663 ArrayIndexOutOfBoundsException thrown by JDBC driver
Submitted: 20 Jan 2006 8:14 Modified: 30 Sep 2008 19:53
Reporter: Terry Email Updates:
Status: Unsupported Impact on me:
None 
Category:MaxDB Severity:S3 (Non-critical)
Version:7_6_00_16_4753 OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[20 Jan 2006 8:14] Terry
Description:
Using JDBC, I enabled statement cache by adding a property cache=all? when creating my database connection. In general it works, however, when doing an exclusive lock on a table, ParseinfoCache reports the following exception:

java.lang.ArrayIndexOutOfBoundsException: 35
        at com.sap.dbtech.jdbc.ParseinfoCache.findParseinfo(ParseinfoCache.java:123)
        at com.sap.dbtech.jdbc.CallableStatementSapDB.doParse(CallableStatementSapDB.java:223)
        at com.sap.dbtech.jdbc.CallableStatementSapDB.constructor(CallableStatementSapDB.java:186)
        at com.sap.dbtech.jdbc.CallableStatementSapDB.<init>(CallableStatementSapDB.java:88)
        at com.sap.dbtech.jdbc.ConnectionSapDB.prepareCall(ConnectionSapDB.java:781)

How to repeat:
Run an SQL statement such as:

"LOCK (WAIT) TABLE T_BOOKING_RECORD  IN EXCLUSIVE MODE"

a couple of times. The second time, the cache will be hit and the exception will occur.

Suggested fix:
Change line 123 of ParseinfoCache.java from:

                this.stats [result.functionCode].addHit ();

to:

                this.stats [mapFunctionCode (result.functionCode)].addHit ();

so that it mirrors the behaviour of addParseinfo(). I have tested this by adding the JDBC source code to my own source tree.
[21 Jan 2006 11:46] C.J. Adams-Collier
Hello Terry,

I've forwarded the link to this bug on to SAP in Berlin.  I expect to hear back from them shortly.  I haven't read this bug too thoroughly quite yet, as I've got some other stuff on my plate.

Cheers,

C.J.
[23 Jan 2006 17:14] C.J. Adams-Collier
Currently being analyzed by SAP Berlin's MaxDB JDBC dev
[23 Jan 2006 17:43] C.J. Adams-Collier
Looks like your patch will be applied to the next version.  Thank you.

From Berlin:

Hi C.J.,
it's a bug in our JDBC driver and will be fixed in the next version. I
will apply the patch suggested by the reporter of this bug. 

Thnak you for forwarding the bug report,
Marco