Announcement Announcement Module
Collapse
No announcement yet.
Warning - SqlOutParameter/SqlReturnResultSet parameter was not declared Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Warning - SqlOutParameter/SqlReturnResultSet parameter was not declared

    Hi All,

    This is my first post and also new to spring. Can any body plz help


    I am getting an warning as "Results returned from stored procedure but a corresponding SqlOutParameter/SqlReturnResultSet parameter was not declared" when calling the store procedure. I am not getting any values from result set.

    Please I am getting null as result. Please help me, Sorry i need to complete this ASAP

    DB : DB2 V 8.2 and Apache Tomcat V5.0


    //Inner class which extends StoreProcedure
    protected class FundProcess extends StoredProcedure{
    public static final String FUND = "FST_GETFUNDBYAMCID";

    public FundProcess(DataSource ds, Integer fundId){
    BasicDataSource ds1 = new BasicDataSource();
    ds1.setDriverClassName("com.ibm.db2.jcc.DB2Driver" );
    ds1.setUrl("jdbc:db2://10.3.14.31:50004/FAST");
    ds1.setUsername("fstadm");
    ds1.setPassword("fst9coke");
    ds1.setDefaultAutoCommit (false);
    log.debug("@@@ Data Source applied : "+ds1);
    setDataSource(ds1);
    setSql(FUND);
    setFunction(false);
    declareParameter(new SqlParameter("FUND_ID", Types.INTEGER));
    declareParameter(new SqlReturnResultSet("rows", new FundMapper()));
    compile();
    }

    public FundProcessM executeF(Integer fundId) {
    Map params = new HashMap();
    params.put("FUND_ID", fundId);
    log.debug("@@@@@ In execute1 method() Running the fund details");
    log.debug(" map size =" + params.size());
    Map results = this.execute(params);
    log.debug("After the executeF method()");
    List curresults = (List)results.get("rows");
    log.debug("After the executeF method()"+curresults);
    return null;
    }

    }

    //Inner class which extends the RowMapper
    private class FundMapper implements RowMapper {
    public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
    Fund f = new Fund();
    f.setFundid(rs.getString(1));
    f.setFundabbr(rs.getString(2));
    return f;
    }
    }



    Method used to call the inner calls FundProcess

    public FundProcessM getFundDetails(Integer fundId) throws DataAccessException {
    log.debug("@@@@@ In get Fund Details");
    FundProcess fundProcess = new FundProcess(this.getDataSource(), fundId);
    return fundProcess.executeF(fundId);
    }

    And also one more clarification? I dont want to depend on BasicDataSource. I want to use DataSource which is independent of Server. Here how can i do autocommit(false) using DataSource, which is not provided by it.

    I will be glad, if my clarifications are cleared

    Thanks in Advance
    Srihar

  • #2
    You need to declare the SqlReturnResultSet as the first parameter. Also not sure why you create a new data source.

    Code:
    //Inner class which extends StoreProcedure
    protected class FundProcess extends StoredProcedure{
      public static final String FUND = "FST_GETFUNDBYAMCID";
    
      public FundProcess(DataSource ds){
        setDataSource(ds);
        setSql(FUND);
        setFunction(false);
        declareParameter(new SqlReturnResultSet("rows", new FundMapper()));
        declareParameter(new SqlParameter("FUND_ID", Types.INTEGER));
        compile();
      }
    }
    Last edited by trisberg; Sep 8th, 2006, 12:23 PM.

    Comment


    • #3
      Hi,

      Thank you very much. I really appreciate for your reply. How do set the Autocommit to false. Does spring automatically does the autocommit to false.
      Datasource does not have autocommit and close.

      Thanks,
      Sriha

      Comment

      Working...
      X