dcsimg
Weird JDBC - Works only for 6 ResultSets -> Extremely Urgent
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Harphajan_Singh
Posted On:   Tuesday, August 6, 2002 03:12 AM

Hey there ! This is seriously an urgent issue . I can get succesful results for only 6 columns. When I attempt to get another Column( anything > 6),I obtain java.lang.ArrayIndexOutOfBoundsException error. Guys,I suspect its becoz of vector. Actually, this is my 3rd query and hence, after each query I push the ResultsSets into an array, then push into vector. I query 15, 5, and 12 columns respectively in my SQLs. Could it possibly be caused becoz I am pushing array`s of different size to the vector ? DB :- Oracle 8.7 JDBC :- CLASSPATH=%JAVA_HOME%lib ools.jar; C:Program FilesApac   More>>

Hey there ! This is seriously an urgent issue .


I can get succesful results for only 6 columns.


When I attempt to get another Column( anything > 6),I


obtain java.lang.ArrayIndexOutOfBoundsException error.


Guys,I suspect its becoz of vector.


Actually, this is my 3rd query and hence, after each query


I push the ResultsSets into an array, then push into vector.


I query 15, 5, and 12 columns respectively in my SQLs.


Could it possibly be caused becoz I am pushing array`s of different size to the vector ?


DB :- Oracle 8.7


JDBC :- CLASSPATH=%JAVA_HOME%lib ools.jar;
C:Program FilesApache Tomcat 4.0libclasses12.zip;
C:Program FilesApache Tomcat 4.0libojdbc14_g.jar;
C:Program FilesApache Tomcat 4.0libocrs12.zip;




Please help, guru`s !!!


Let me know , if my entire (short piece) of code it necessary !


Attached is my code which generates the java.lang.ArrayIndexOutOfBoundsException error.:-


			
innerRset = statement.executeQuery("SELECT HBR_TEST_END_TIME,HBR_LOT_NUMBER,HBR_TEST_HEAD,HBR_DUT_SITE, HBR_BIN1, HBR_BIN2, HBR_BIN3 FROM TRDB_HBR WHERE HBR_TEST_END_TIME =TO_DATE('" + newDate +"', 'yyyy-mm-dd HH24:mi:ss')");
while (innerRset.next())
{
String[] columnsHBR = new String[6];
columnsHBR[0] = innerRset.getString(1);
columnsHBR[1] = innerRset.getString(2);
columnsHBR[2] = innerRset.getString(3);
columnsHBR[3] = innerRset.getString(4);
columnsHBR[4] = innerRset.getString(5);
columnsHBR[5] = innerRset.getString(6); //Works fine till here !
columnsHBR[6] = innerRset.getString(7);// Generates the error if I try the 7th`
vector.add(columnsHBR);

/* Print HBR Results */
Enumeration enum3 = vector.elements();
while (enum3.hasMoreElements())
{
System.out.println("Printing Vector Results");
String[] columns3 = (String[]) enum3.nextElement();
out.println(columns3[0] + columns3[1] + columns3[2] + columns3[3] + columns3[4] + columns3[5] + "

");
}
} // close HBR
   <<Less

Re: Weird JDBC - Works only for 6 ResultSets -&gt; Extremely Urgent

Posted By:   Simone_Re  
Posted On:   Tuesday, August 6, 2002 04:36 AM

I think the problem is about the dimension of the "columnsHBR" array. This array have six positions form 0 to 5, when you try to store in position 6 the 7th column of the ResultSet you get the Exception.

Try to declare "columnsHBR" as "new String[7]" (from 0 to 6).
About | Sitemap | Contact