Menu

#376 ArrayIndexOutOfBoundException

JDBC
closed-out-of-date
None
5
2017-01-09
2016-06-27
Luigi Vaira
No

Hi! I have a problem with JDBC and a simple query. This is the code:

try {
                    Class.forName("com.ibm.as400.access.AS400JDBCDriver");
                    AS400JDBCConnection conn = (AS400JDBCConnection) DriverManager.getConnection(conn_string, user, password);
                    if (conn.isValid(3)) {
                        AS400JDBCStatement stm = (AS400JDBCStatement) conn.createStatement();
                        ResultSet rs = stm.executeQuery("select * from ILVCPA.ILLFAL for fetch only");
                        System.out.println(rs.getFetchSize());
                    }
                } catch (ClassNotFoundException | SQLException e) {
                    e.printStackTrace();
                }

This is the exception result:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 134
at com.ibm.as400.access.ConvTableSingleMap.byteArrayToString(ConvTableSingleMap.java:46)
at com.ibm.as400.access.ConvTable.byteArrayToString(ConvTable.java:80)
at com.ibm.as400.access.DBReplySQLCA.getErrp(DBReplySQLCA.java:112)
at com.ibm.as400.access.AS400JDBCStatement.commonExecute(AS400JDBCStatement.java:1018)
at com.ibm.as400.access.AS400JDBCStatement.executeQuery(AS400JDBCStatement.java:2435)
at laf.cpa.automation.TestJT400_MAIN.main(TestJT400_MAIN.java:75)

Any clue? Thanks in advance
Luigi

Discussion

  • John Eberhard

    John Eberhard - 2016-06-27

    Can you take a JTOpen trace and attach it?

    To use tracing for toolbox define the properties to the JVM running toolbox

    com.ibm.as400.access.Trace.category=ALL
    com.ibm.as400.access.Trace.file=/tmp/out.txt

    The output of the trace will be in /tmp/out.txt

    If running from the command line, you can specify this using

    java -Dcom.ibm.as400.access.Trace.category=ALL -Dcom.ibm.as400.access.Trace.file=/tmp/out.txt JAVAPROGAM

     
  • Luigi Vaira

    Luigi Vaira - 2016-06-27

    Attachment "as400.txt". Thanks for your answer, John.
    Luigi

     
  • Luigi Vaira

    Luigi Vaira - 2016-06-27

    From the trace, it seems that the data source format is correctly recognized:

    Thread[main,5,main] Mon Jun 27 15:16:08:714 CEST 2016 receive(): Valid reply found: 4
    Thread[main,5,main] Mon Jun 27 15:16:08:714 CEST 2016 decompressRLE() sourceLength: 1363
    Thread[main,5,main] Mon Jun 27 15:16:08:714 CEST 2016 decompressRLE() destinationLength: 1692
    Thread[main,5,main] Mon Jun 27 15:16:08:717 CEST 2016 SQLDataFactory.newData(nativeType=488,length=8,precision=8,scale=0,ccsid=0)
    Thread[main,5,main] Mon Jun 27 15:16:08:722 CEST 2016 SQLDataFactory.newData(nativeType=488,length=3,precision=3,scale=0,ccsid=0)
    Thread[main,5,main] Mon Jun 27 15:16:08:722 CEST 2016 SQLDataFactory.newData(nativeType=452,length=1,precision=0,scale=1,ccsid=280)
    Thread[main,5,main] Mon Jun 27 15:16:08:723 CEST 2016 SQLDataFactory.newData(nativeType=488,length=8,precision=8,scale=0,ccsid=0)
    Thread[main,5,main] Mon Jun 27 15:16:08:723 CEST 2016 SQLDataFactory.newData(nativeType=488,length=8,precision=8,scale=0,ccsid=0)
    Thread[main,5,main] Mon Jun 27 15:16:08:723 CEST 2016 SQLDataFactory.newData(nativeType=488,length=8,precision=8,scale=0,ccsid=0)
    Thread[main,5,main] Mon Jun 27 15:16:08:723 CEST 2016 SQLDataFactory.newData(nativeType=488,length=8,precision=8,scale=0,ccsid=0)
    Thread[main,5,main] Mon Jun 27 15:16:08:723 CEST 2016 SQLDataFactory.newData(nativeType=452,length=6,precision=0,scale=6,ccsid=280)
    Thread[main,5,main] Mon Jun 27 15:16:08:723 CEST 2016 SQLDataFactory.newData(nativeType=488,length=6,precision=6,scale=0,ccsid=0)
    Thread[main,5,main] Mon Jun 27 15:16:08:723 CEST 2016 SQLDataFactory.newData(nativeType=488,length=7,precision=7,scale=3,ccsid=0)
    Thread[main,5,main] Mon Jun 27 15:16:08:723 CEST 2016 SQLDataFactory.newData(nativeType=452,length=2,precision=0,scale=2,ccsid=280)
    Thread[main,5,main] Mon Jun 27 15:16:08:723 CEST 2016 SQLDataFactory.newData(nativeType=452,length=2,precision=0,scale=2,ccsid=280)
    Thread[main,5,main] Mon Jun 27 15:16:08:723 CEST 2016 SQLDataFactory.newData(nativeType=452,length=8,precision=0,scale=8,ccsid=280)
    Thread[main,5,main] Mon Jun 27 15:16:08:724 CEST 2016 SQLDataFactory.newData(nativeType=488,length=4,precision=4,scale=0,ccsid=0)
    Thread[main,5,main] Mon Jun 27 15:16:08:724 CEST 2016 SQLDataFactory.newData(nativeType=452,length=2,precision=0,scale=2,ccsid=280)
    Thread[main,5,main] Mon Jun 27 15:16:08:724 CEST 2016 SQLDataFactory.newData(nativeType=452,length=4,precision=0,scale=4,ccsid=280)
    Thread[main,5,main] Mon Jun 27 15:16:08:724 CEST 2016 SQLDataFactory.newData(nativeType=488,length=5,precision=5,scale=0,ccsid=0)
    Thread[main,5,main] Mon Jun 27 15:16:08:724 CEST 2016 SQLDataFactory.newData(nativeType=488,length=6,precision=6,scale=3,ccsid=0)
    Thread[main,5,main] Mon Jun 27 15:16:08:724 CEST 2016 SQLDataFactory.newData(nativeType=452,length=3,precision=0,scale=3,ccsid=280)
    Thread[main,5,main] Mon Jun 27 15:16:08:724 CEST 2016 SQLDataFactory.newData(nativeType=452,length=5,precision=0,scale=5,ccsid=280)
    Thread[main,5,main] Mon Jun 27 15:16:08:724 CEST 2016 SQLDataFactory.newData(nativeType=488,length=4,precision=4,scale=0,ccsid=0)
    Thread[main,5,main] Mon Jun 27 15:16:08:724 CEST 2016 SQLDataFactory.newData(nativeType=452,length=15,precision=0,scale=15,ccsid=280)
    Thread[main,5,main] Mon Jun 27 15:16:08:724 CEST 2016 SQLDataFactory.newData(nativeType=452,length=15,precision=0,scale=15,ccsid=280)
    Thread[main,5,main] Mon Jun 27 15:16:08:724 CEST 2016 SQLDataFactory.newData(nativeType=452,length=2,precision=0,scale=2,ccsid=280)
    Thread[main,5,main] Mon Jun 27 15:16:08:724 CEST 2016 as400: Statement STMT0001 (517380410) : Prepared STMT0001*, SQL Statement -->[select * from ILVCPA.ILLFAL for fetch only].

     
  • John Eberhard

    John Eberhard - 2016-06-27

    The server response for the request to fetch the data returned an error indicating that an exit program caused the request to be rejected. It looks like the JTOpen code is not handling this error case.

    Data Requesting Function: 0x180E - Open/Describe/Fetch
    ORS Requesting Function: 0x180E - Open/Describe/Fetch
    Error Class: 0x0008 - Exit Program Error
    Error Return Code: -101 - User exit program rejected request.


    Parameter: 0x3807 - SQLCA

    Parameter: 0x380E - Extended Result Data

    Can you check the system for an exit program that is blocking the request? Use WRKREGINF and look for programs registered on the QIBM_QZDA_xxx exit points.

     
  • Luigi Vaira

    Luigi Vaira - 2016-06-28

    Unfortunely I have no chance to check the system. However, I don't know if it is a particular behaviour of the Client Access Terminal, but as you can see from the attached screenshot, I am able to fetch data using the IBM Data Transfer utility using the same credentials. I am sure there is an exit program activated: I can see the "user permission denied" exception on some others queries, but not this.

    Edit:
    Added "T1.txt": trace for ArrayOutOfBoundException (the old one)
    Added "T2.txt": trace for "Function rejected by user exit program..." (query changed from "select * from ILVCPA.ILLFAL for fetch only" to "select * from ILLFAL for fetch only")

    Note that in T1 trace I was able to retreive native fields format

     

    Last edit: Luigi Vaira 2016-06-28
  • John Eberhard

    John Eberhard - 2017-01-09
    • status: open --> closed-out-of-date
    • assigned_to: John Eberhard
     
  • John Eberhard

    John Eberhard - 2017-01-09

    Closing old bug. It looks like this was an exit program issue.

     

Log in to post a comment.