Announcement Announcement Module
Collapse
No announcement yet.
Spring StoredProcedure and DB2 Dynamic Result Set Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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());
    }
    }


    --------------------------------------------------------------
Working...
X