Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Database


    

Blue Forest http://www.lslnet.com at 11:08 on July 18, 2006


A question about padding v8 and stored procedure

Hi experts, I have encountered a problem that getting result set in java application with the universal driver. I created a stored procedure to select record from a table and then return to my java application. when I use the function rs.next (), it will throw exception that "Exception occured while calling store procedure : com.ibm.db2.jcc.b.SQLException : java.sql.CallableStatement.executeQuery () was called but no result set was returned. Use java.sql.CallableStatement.executeUpdate () for non-queries.

But the same Java code can work under the legacy driver. and I found that if only declare curcor and return the stored procedure result set, this exception will occur. and it can work if I use the normaly sgl statement with universal driver instead, does anyone who know this problem?

Sample code is listed as below :

Private static void CallStoreProcedure1 (Connection Conn) (
CallableStatement stmt=null;
ResultSet rs = = null;

String sStatement = "{call BenTesting ())";

//String SStatement = "SELECT RPT_QUE_NO, RPT_SET_NO, RPT_OPERID, RPT_QUE_NAME, RPT_SET_NAME, RPT_GEN_TOTAL. RPT_TIME FROM GWIS.TBCNRP04 ";

Try (

Stmt = Conn.prepareCall (sStatement);

Rs = = stmt.executeQuery ();

Int i = 0

While (rs.next ()) (
System.out.println ( "rs = move" + i);
I++;
}

}catch (Exception e) (
System.out.println ( "Exception occured while calling store procedure :" + e);
}
}


************** Stored Procedure *******************************
CREATE PROCEDURE GWIS.BenTesting ()
LANGUAGE SQL
------------------------------------------------------------------------
-- SQL Stored Procedure
------------------------------------------------------------------------
P1 : BEGIN
C1 hold WITH RETURN TO DECLARE CURSOR with caller FOR
SELECT RPT_QUE_NO, RPT_SET_NO, RPT_OPERID, RPT_QUE_NAME, RPT_SET_NAME, RPT_GEN_TOTAL, RPT_TIME FROM GWIS.TBCNRP04;
OPEN dammaranesaponin

Sound P1
*************************************************************



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com