File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Strange !! ArrayOutOfBoundsException in ResulltSet.next() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Strange !! ArrayOutOfBoundsException in ResulltSet.next()" Watch "Strange !! ArrayOutOfBoundsException in ResulltSet.next()" New topic
Author

Strange !! ArrayOutOfBoundsException in ResulltSet.next()

Kaustubh Patil
Ranch Hand

Joined: Aug 13, 2001
Posts: 164
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.


Kaustubh. Mumbai, India.
kundi kx
Greenhorn

Joined: Feb 03, 2003
Posts: 10
Could you quote the offending block of code?
Kaustubh Patil
Ranch Hand

Joined: Aug 13, 2001
Posts: 164
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

Joined: Aug 13, 2001
Posts: 164
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Strange !! ArrayOutOfBoundsException in ResulltSet.next()
 
Similar Threads
Problem with JDBC setResult on JTextarea
JBoss throws this exception ORA-01858:a non-numeric character was found where a numeric was expected
Multiple clients
WITH clause generates ORA-01009: missing mandatory parameter
I am getting error like ResultSet is not clled....plz help