Invalid parameter binding

From: Earl Hokens (earl.hokensREMOVETHIS_at_chi.frb.org)
Date: 11/16/04

  • Next message: Bjorn Abelli: "Re: Invalid parameter binding"
    Date: Mon, 15 Nov 2004 17:58:42 -0600
    
    

    I am having a problem with calling a stored procedure. I have
    replicated the problem with multiple JDBC drivers so it doesn't seem to
    be driver related. The stored procedure works when I execute in SQL
    Enterprise Manager so it isn't the SQL Manager. The code hasn't changed
    and it was working at one time so I need help!

    I am calling a simple stored procedure that either inserts or updates a
    record into a single table and returns the ID for the record. The
    stored procedure definition is as follows:

            CREATE PROCEDURE dbo.updateDistrictFiles
                    @brochureId int,
                    @districtId int,
                    @contactTypeId int,
                    @fileDesc varchar(50),
                    @filePath varchar(100),
                    @brochureIdOut int OUTPUT
            ....

    The java code invoking the SP is as follows:

       CallableStatement c = connection. prepareCall("? = call
    updateDistrictFiles(?, ?, ?, ?, ?, ?)";
       int index = 1;

       cstmt.setInt(index++, getBrochureId());
       cstmt.setInt(index++, getDistrictId());
       cstmt.setInt(index++, getContactTypeId());
       cstmt.setString(index++, getBrochureDescription());
       cstmt.setString(index++, getBrochureLocation());

       cstmt.registerOutParameter(index, Types.NUMERIC); // tried INTEGER too

       recordCount = cstmt.executeUpdate();
       newBrochureId = cstmt.getInt(index);

    The "executeUpdate" throws the Java Exception with the message:
    [Microsoft][SQLServer 2000 Driver for JDBC]Invalid parameter binding(s).
    Partial stack trace below.

    Any help would be GREATLY appreciated!

    TIA
    Earl

    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
    JDBC]Invalid parameter binding(s).
    [11/15/04 17:55:53:066 CST] 30e29198 SystemErr R at
    com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
    [11/15/04 17:55:53:066 CST] 30e29198 SystemErr R at
    com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    [11/15/04 17:55:53:066 CST] 30e29198 SystemErr R at
    com.microsoft.jdbc.base.BasePreparedStatement.validateParameters(Unknown
    Source)
    [11/15/04 17:55:53:066 CST] 30e29198 SystemErr R at
    com.microsoft.jdbc.base.BasePreparedStatement.validateParameters(Unknown
    Source)
    [11/15/04 17:55:53:086 CST] 30e29198 SystemErr R at
    com.microsoft.jdbc.base.BasePreparedStatement.preImplExecute(Unknown Source)
    [11/15/04 17:55:53:086 CST] 30e29198 SystemErr R at
    com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
    [11/15/04 17:55:53:086 CST] 30e29198 SystemErr R at
    com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
    [11/15/04 17:55:53:086 CST] 30e29198 SystemErr R at
    com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
    [11/15/04 17:55:53:096 CST] 30e29198 SystemErr R at
    com.microsoft.jdbcx.base.BasePreparedStatementWrapper.executeUpdate(Unknown
    Source)
    [11/15/04 17:55:53:096 CST] 30e29198 SystemErr R at
    com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(WSJdbcPreparedStatement.java:555)
    [11/15/04 17:55:53:096 CST] 30e29198 SystemErr R at
    org.frb.chi.electronic.Brochure.update(Brochure.java:494)


  • Next message: Bjorn Abelli: "Re: Invalid parameter binding"

    Relevant Pages

    • Invalid parameter binding
      ... I am having a problem with calling a stored procedure. ... The java code invoking the SP is as follows: ... [SQLServer 2000 Driver for JDBC]Invalid parameter binding. ...
      (comp.lang.java.help)
    • Re: Stored Procedure error is not catched
      ... >> I am using MS SQL Server JDBC Driver. ... The Stored Procedure does some inserts. ... >> failed but in my java code the SQLException is not thrown. ... The problem is that the SQLException (or really the error message ...
      (microsoft.public.sqlserver.jdbcdriver)
    • Re: Callablestatement.execute() and clearParameter() causing excep
      ... Joe Weinstein at BEA Systems ... Driver version is 1.0.809.102 ... A server cursor cannot be opened on the given ... on a remote stored procedure or stored procedure with more than one SELECT statement. ...
      (microsoft.public.sqlserver.jdbcdriver)
    • RE: odbccommand cant interpret some /*xxx*/ comments
      ... I have tried your query (creating stored procedure) with the API ... SQLExecDirect in the driver "SQL Server". ... The problem doesn't reproduce. ...
      (microsoft.public.data.odbc)
    • Re: DBD::Sybase and $sth->{syb_result_type} v. DBD::ODBC (Sql Server)
      ... write output parameters and return a value. ... individual operations in the procedure by calling odbc_more_results. ... Things get a little more complex for what I guess Sybase calls CS_MSG_RESULT ... the status from a stored procedure was ...
      (perl.dbi.users)