Java w/SQL Server Express 2008 - 索引超出范围异常

BS_*_*_C3 2 java exception sql-server-express sql-server-2008

我在sql express 2008中创建了一个存储过程,当从Java方法调用该过程时,我收到以下错误:

Index 36 is out of range.
com.microsoft.sqlserver.jdbc.SQLServerException:Index 36 is out of range.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:170)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setterGetParam(SQLServerPreparedStatement.java:698)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setValue(SQLServerPreparedStatement.java:707)
    at com.microsoft.sqlserver.jdbc.SQLServerCallableStatement.setString(SQLServerCallableStatement.java:1504)
    at fr.alti.ccm.middleware.Reporting.initReporting(Reporting.java:227)
    at fr.alti.ccm.middleware.Reporting.main(Reporting.java:396)
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚它来自哪里......> _ <

任何帮助,将不胜感激.

此致,BS_C3


这是一些源代码:

public ArrayList<ReportingTableMapping> initReporting(
        String division,
        String shop,
        String startDate,
        String endDate)
{
    ArrayList<ReportingTableMapping> rTable = new ArrayList<ReportingTableMapping>();

    ManagerDB db = new ManagerDB(); 
    CallableStatement callStmt = null;
    ResultSet rs = null;
    try {
         callStmt = db.getConnexion().prepareCall("{call getInfoReporting(?,...,?)}");
         callStmt.setString("CODE_DIVISION", division);
         .
         .
         .
         callStmt.setString("cancelled", " ");

         rs = callStmt.executeQuery();
         while (rs.next())
         {
             ReportingTableMapping rtm = new ReportingTableMapping(
                     rs.getString("werks"), ... );

             rTable.add(rtm);
         }
         rs.close();
         callStmt.close();

    } catch (Exception e) {
          System.out.println(e.getMessage());
          e.printStackTrace();
    } finally {
          if (rs != null)
                try { rs.close(); } catch (Exception e) { }
          if (callStmt != null)
                try { callStmt.close(); } catch (Exception e) { }
          if (db.getConnexion() != null)
                try { db.getConnexion().close(); } catch (Exception e) { }
    }   

    return rTable;
}
Run Code Online (Sandbox Code Playgroud)

Sea*_*lly 8

没有提供足够的源代码来确定,但根据堆栈跟踪,我的赌注是多少?占位符和提供的参数数量不匹配.我的猜测是你没有足够的占位符.我建议仔细检查以确保每个都有正确的数量.