Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> JDBC / ref cursor and VARRAY
Hello
I had some Java code connecting to a database that worked up until a recent upgrade to 9i. We upgraded the Oracle driver to the latest classes12.zip. The code is below - hoping someone can help. Basically, the procedure being called returns a ref cursor. One of the fields in the ref cursor is a VARRAY of numbers which are fetched using BigDecimal. This still works. The part I am having problem with is that another field contains a VARRAY of VARCHAR2 data. I used to bring this into a String ARRAY. This now fails.
// First section, prepares and makes the call
cstmt = dbConn.prepareCall("{ call map_details.obtain(?,?,?,?,?) }");
cstmt.setLong(1, Long.valueOf(var1).longValue()); cstmt.setInt(2, var2); cstmt.setInt(3, var3); cstmt.setInt(4, var3); cstmt.registerOutParameter(5, OracleTypes.CURSOR); cstmt.execute();
// This still works
ARRAY array = rs.getARRAY(5);
BigDecimal[] values = (BigDecimal[]) array.getArray();
BigDecimal westTM = values[0];
BigDecimal southTM = values[1];
BigDecimal eastTM = values[2];
BigDecimal northTM = values[3];
// This now fails but used to work
ARRAY array_i = rs.getARRAY(6); String[] values_i = (String[]) array_i.getArray(); for (int j=0; j<values_i.length; j++) { String value = values_i[j]; System.out.println(value+"s next im"); if ( j > 0 ) imageList = imageList + ", " + value; else imageList = imageList + "" + value; } // End of loop through ordinate array of imag
Thanks
Chris Received on Mon Apr 08 2002 - 05:17:31 CDT