Hello,
The code below is abbreviated. If you try this against an Oracle database you will (from a Tomcat pool) have a connection, with cursors left open. If you could cast the ResultSet/CallableStatement to the Oracle versions then you will not get the cursors left open...
...
CallableStatement stmt = null;
ResultSet rs = null;
List hotels = new ArrayList();
try
{
// prepare the call
stmt =
getConnection().prepareCall(
"{? = call PACKAGE.search(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}");
// bind the parameters
int count = 1;
stmt.registerOutParameter(count++, OracleTypes.CURSOR);
// ... bind all the stuff
// grab the results
stmt.execute();
rs = (ResultSet)stmt.getObject(1);
while (rs.next())
{
Thing thing= new Thing();
// grab the results
count = 1;
thing= .setX(rs.getString(count++));
thing= .setY(rs.getString(count++));
thing= .setZ(rs.getString(count++));
// add to list
things.add(avail);
}
}
catch (IOException e)
{
// Log this error
LoggerHelper.log(logger, Priority.ERROR, e);
// throw an exception
throw new SQLException("");
}
catch (SQLException e)
{
// Log this error
LoggerHelper.log(logger, Priority.ERROR, e);
// throw an exception
throw new SQLException("");
}
finally
{
// clean up
close(rs);
close(stmt);
closeConnection();
}
// return the things
return things;
...
Cheers,
Ernie