Subject Re: only one resultset at a time/statement?
Author burghard_w_v_britzke
--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy" <rrokytskyy@a...> wrote:
> > when trying to get the resultset for my prepared statement, I get the
> > following exception:
> >
> > org.firebirdsql.jdbc.FBSQLException: Only one resultset at a
> > time/statement.
> > at org.firebirdsql.jdbc.AbstractStatement.getResultSet(
> > AbstractStatement.java:531)
> >
> > what happened?
>
> See documentation to java.sql.Statement.getResultSet():
>
> public ResultSet getResultSet()
> throws SQLException
>
> Retrieves the current result as a ResultSet object. This method should
> be called only once per result.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Returns:
> the current result as a ResultSet object or null if the result is
> an update count or there are no more results
> Throws:
> SQLException - if a database access error occurs
> See Also:
> execute(java.lang.String)

It is prepared statement which is executed immediately before the getResultSet() which
raises the exception. so it is not called twice for that executeQuery(). the code is in a large
db-framework (http://www.jdataset.de), which works with many jdbc-drivers with that
code. and it work mainly with the jaybird-jdbc-driver.

PreparedStatement stmt = = con.prepareStatement("SELECT ID FROM TABLE...");
...
stmt.executeQuery();
ResultSet rs = stmt.getResultSet(); // here, the exception is raised