Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange !! ArrayOutOfBoundsException in ResulltSet.next()

 
Kaustubh Patil
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to loop through a resultset in a usaual way by using while(resultset.next()).
But its throwing an ArrayOutOfBounds Exeption on the second call to the resultset.next() (when the resultset had 2 rows).
A part of the stack trace of the exception is given below.
---------------------------
java.lang.ArrayIndexOutOfBoundsException at oracle.jdbc.ttc7.NonPlsqlTTCColumn.unmarshal(NonPlsqlTTCColumn.java:134) at oracle.jdbc.ttc7.NonPlsqlTTCDataSet.unmarshalRow(NonPlsqlTTCDataSet.java:178) at oracle.jdbc.ttc7.TTIrxd.unmarshal(TTIrxd.java:161) at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:826) at oracle.jdbc.driver.OracleStatement.fetchNextColumns(OracleStatement.java:4225) at oracle.jdbc.driver.OracleInputStream.needBytes(OracleInputStream.java:78) at oracle.jdbc.driver.OracleInputStream.close(OracleInputStream.java:132) at oracle.jdbc.driver.OracleResultSetImpl.prepare_for_new_row(OracleResultSetImpl.java:647) at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:216) at
---------------------------------------------
Thanks in advance for any help.
-Kaustubh.
 
kundi kx
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you quote the offending block of code?
 
Kaustubh Patil
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is that code,
while(rsDocs.next()){
System.out.println(" row no. "+ counter);
System.out.println("--1");
docID = rsDocs.getString(1);
status = rsDocs.getString(2);
docTypeCode = rsDocs.getString(3);
supplierDoc = rsDocs.getString(4);
partNum = rsDocs.getString(5);
recvDate = rsDocs.getString(6);
stickyNote = rsDocs.getString(7);
componentNum = rsDocs.getString(8);
strSerial = rsDocs.getString(9);
System.out.println("--2");
}
also i am getting an arrayoutof bounds exception on getString(7). Though the resultsetmetatdata is giving me a column count of 9 !!!
I cannot understand this..
 
Kaustubh Patil
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to debug the above code and then found out that the problem is not in the resultset.next() but when the driver is reading the "LONG" type of value returned by the PLSQL procedure.
Again the problem is that when I am returning the LONG column as the first in the select there is no error, but when I change the position of the LONG column in the select the exception starts occuring from that line. And again its ArrayOutOfBoundsException.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic