Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 20 2001
Added on Oct 19 2001
3 comments
234 views