try {
CallableStatement cs = jdbcConnection.prepareCall(queryString);
Iterator inParams = parameters.inParams().iterator();
while (inParams.hasNext()) {
Parameter param = (Parameter) inParams.next();
if (param.getIndex() == 0)
param.setIndex(queryString.getParameterIndex(param.getName()));
cs.setObject(param.getIndex(), param.getValue());
}
// register out parameters
Iterator outParams = parameters.outParams().iterator();
while (outParams.hasNext()) {
Parameter param = (Parameter) outParams.next();
if (param.getIndex() == 0)
param.setIndex(queryString.getParameterIndex(param.getName()));
DebugUtil.debugln(getClass(), debug, "Registering parameter " + param.getName());
cs.registerOutParameter(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType()));
}
// Using execute because Derby does not currenlty support
// executeQuery
// for SP
cs.execute();
ResultSet results = cs.getResultSet();
Iterator i = parameters.outParams().iterator();
while (i.hasNext()) {
Parameter param = (Parameter) i.next();
param.setValue(cs.getObject(param.getIndex()));
}
return results;
} catch (SQLException ex) {
ex.printStackTrace();