Announcement Announcement Module
No announcement yet.
Spring failed to count the correct number of parameters Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring failed to count the correct number of parameters

    It seems there is bug in Spring that it miss count the number of parameters. Spring seems expecting 5 parameters (in my case) which is wrong, it shall be 4 parameters.

    My store procedure takes 2 inputs and 1 output and it return an integer error code, something likes "OUT = prc_fmw_get_cont_from_ssn (IN, IN, OUT)".
    In my code, I call "setFunction(true)". I call declareParameter() 4 times. First one is for return code, and the 2nd, 3th are for input, and 4th is for output (error message).

    Anybody out there had experience with similar issue.
    We are using Sybase database, and the stored procedure return 2 resultsetS, and 1 error code and 1 error message.


    Here is my code:
    protected ContractsFromSsnProc(DataSource ds) {

    declareParameter(new SqlReturnResultSet("contractResultSet", this));
    declareParameter(new SqlReturnResultSet("roleResultSet", this));

    declareParameter(new SqlOutParameter("returnCode", java.sql.Types.INTEGER));
    declareParameter(new SqlParameter("ssn", java.sql.Types.VARCHAR));
    declareParameter(new SqlParameter("policyStatusMaskname", java.sql.Types.VARCHAR));
    declareParameter(new SqlOutParameter("errorMessage", java.sql.Types.VARCHAR));

    // -------- here is the error that I encountered
    [1/27/05 10:38:21:200 EST] 6b6340b9 ContractsFrom I com.fili.bizsrv.lifecad.dataaccess.ContractsFromSs nProc Compiled stored procedure. Call string is [{? = call prc_fmw_get_cont_from_ssn(?, ?, ?, ?)}]
    [1/27/05 10:38:21:763 EST] 6b6340b9 WebServicesSe E rvicesServlet WSWS3227E: Error: Exception:
    [1/27/05 10:38:21:778 EST] 6b6340b9 WebServicesSe E rvicesServlet TRAS0014I: The following exception was logged WebServicesFault
    faultCode: Server.generalException
    faultString: org.springframework.jdbc.UncategorizedSQLException : (executing CallableStatementCallback [CallableStatementCreatorFactory.CallableStatementC reatorImpl: sql=[{? = call prc_fmw_get_cont_from_ssn(?, ?, ?, ?)}]: params=[{ssn=383000350, policyStatusMaskname= }]]): encountered SQLException [JZ0SA: Prepared Statement: Input parameter not set, index: 4.]; nested exception is java.sql.SQLException: JZ0SA: Prepared Statement: Input parameter not set, index: 4.
    faultActor: null

  • #2
    Could any Spring DAO people take a look on this issue?


    • #3
      I'll try to look into this - problem is i don't have a Sybase database up and running right now. I'll keep you posted.


      • #4
        Spring failed to count the correct number of parameters


        I am getting similar problem.

        I have a simple stored procedure GetDestinationList which takes no parameter and retruns a resultset and a return value.

        I have declared my parameters as follows and it gives similar problem as you are getting:

        declareParameter(new SqlReturnResultSet("rs", ExtractResultSet);
        declareParameter(new SqlOutParameter("RETURN", Types.NUMERIC));

        where ExtractResultSet implements ResultSetExtractor.

        Would you pls advise how you have resolved this problem ?



        • #5
          Turned out it did not have anything to do with Sybase - we just did not count the parameters correctly for a function returning multiple resultsets. I have fixed this and it will be part of 1.2RC1 due out next week.