Re: Java / Oracle Callable Statement with Null ResultSet

From: Andy Flowers <andrew.flowers_at_npspam.ntlworld.com>
Date: Fri, 27 Jun 2003 14:36:44 +0100
Message-ID: <KMXKa.2069$MO2.1740_at_newsfep4-winn.server.ntli.net>


Try

ResultSet rs2 = (ResultSet)callstmt.getObject(1);

"echohead" <echohead_at_netzero.net> wrote in message news:373d8fb9.0306270518.30cf2e34_at_posting.google.com...
> This is my first shot at a callablestatement, and have had some basic
> problems (such as wrong number or type of parameters sent) getting
> this to work. I think I have it working now, except for the fact that
> my result set continues to be null, and there should be records. Can
> anyone provide any insight into whether the following code is correct,
> or, any changes I need to make?
>
>
> // CODE SNIP
> java.sql.Date d = new java.sql.Date(1994, 1, 1);
>
> java.sql.Connection connX =
> com.xxxx.XXXX.XXXX.DBODSConnection.getConnection("DEVELOPMENT");
>
> java.sql.CallableStatement callstmt = null;
> callstmt = connX.prepareCall("begin ? := PKSTATETAX.GETSTATETAXLIST(?,
> ?); end;");
>
> callstmt.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR);
> callstmt.setString(2, "PT");
> callstmt.setDate(3, d);
>
> callstmt.execute();
>
> java.sql.ResultSet rs2 = (java.sql.ResultSet) callstmt.getResultSet();
>
> // QUICK TEST OF RESULTSET
> if (rs2 == null) {out.println("RS null");}
> else {
> int iCount2 = 0;
> while (cursor.next()) {
> iCount2 = iCount2 + 1;
> out.println(iCount2);
> }
> }
>
> Thanks for your help.
Received on Fri Jun 27 2003 - 15:36:44 CEST

Original text of this message