PreparedStatement reuse
843854Oct 19 2001 — edited Oct 23 2001
Is it possible to use a PreparedStatement after its resultset has been processed? It seems to me like once you iterate through the ResultSet the PreparedStatement can not be executed again with a different set of parameters. Is this correct? I'm using the JdbcOdbcDriver, but I am also looking at the Sybase Jconnect driver. Could this be a driver issue?
here is some pseudocode:
statement = connection.prepareStatement("Select ....");
for (i = 0; i < 10; ++i) {
statement.setInt(1, intVal);
statement.setString(2, strVal);
statement.execute();
result = statement.getResultSet();
process the results
}
Problem is that with the 2nd iteration I get a java.sql.SQLException: Invalid handle.