Hi,
I am trying to call an SQL Server stored procedure that requires params but I always get this error:
java.sql.SQLException: Procedure or function 'mySP' expects parameter '@param1', which was not supplied.
Here is the java code:
Thanks!Code:private SimpleJdbcCall mTemplate; private final String PARAM1 = "param1"; public void setDataSource(DataSource pDS) { mTemplate = new SimpleJdbcCall(pDS) .withCatalogName("dbo") .withProcedureName("mySP") .useInParameterNames(PARAM1) .declareParameters(new SqlParameter(PARAM1, Types.INTEGER)) .returningResultSet("results", new MyResultMapper()); } public MyResults search() { MyResults oResult = new MyResults(); SqlParameterSource oParams = new MapSqlParameterSource() .addValue(PARAM1, 46); Map<String, Object> oMapResults = mTemplate.execute(oParams); ... return oResult; }


Reply With Quote