-
Mar 3rd, 2010, 12:15 AM
#1
Spring StoredProcedure and DB2 Dynamic Result Set
I am trying to call a stored procedure in DB2 using Spring's StoredProcedure. I can read the out parameters which are declared explicitly but I can't read the DYNAMIC RESULT SET.
Please advise.
Here is the code snippet:
--------------------------------------------------------------
Procedure
----------
CREATE PROCEDURE SP_MYPROC (
OUT out_sqlcode INTEGER,
OUT out_sqlstate CHAR(5),
OUT out_message VARCHAR(300))
DYNAMIC RESULT SETS 1
LANGUAGE SQL
BEGIN
......
END
--------------------------------------------------------------
Spring Code
-----------
public class MyStoredProcedure extends StoredProcedure {
private static final String STORED_PROC = "SP_MYPROC";
public MyStoredProcedure(DataSource dataSource) {
super(dataSource, STORED_PROC);
declareParameter(new SqlOutParameter("out_sqlcode", Types.INTEGER));
declareParameter(new SqlOutParameter("out_sqlstate", Types.CHAR));
declareParameter(new SqlOutParameter("out_message", Types.VARCHAR));
compile();
setSqlReadyForUse(true);
}
private Map execute() {
Map outParams = super.execute(new HashMap());
return outParams;
}
public void run() {
System.out.println(execute());
}
}
--------------------------------------------------------------
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules