Subject | JBIRD 1.55+ Double trouble |
---|---|
Author | nagypapi |
Post date | 2005-09-13T18:19:59Z |
My program errors like never before :)
The code snippet in my program:
"
...
conn.setAutoCommit(false);
Statement st=conn.createStatement();
Statement st2=conn.createStatement();
String query="select a,lot,of,stuff from a_table where
date>='"+date+"' order by something";
ResultSet rs=st.executeQuery(query);
while(rs.next()) {
do_stuff_that_only_read_from_rs();
query="select some,other,stuff from a_different_table where
id="+idFromFirstQuery;
ResultSet rs2=st2.executeQuery(query);
while(rs2.next()) do_stuff_that_only_read_from_rs2();
}
...
"
if there is no data returned from the first query, I get no problem.
But if there is data returned from the first query, I get an Exception
both with JBIRD1.55 and with JBIRD2.
This code worked beforehand with JBIRD1.55, until I put in the
setAutoCommit(false)!
And this is not all. It seems I get a different error at a different
place with embedded and with ss.
Embedded Error occurs at while(rs.next()) :
"
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic
SQL Error
SQL error code = -504
Cursor
at
org.firebirdsql.jdbc.FBStatementFetcher.fetch(FBStatementFetcher.java:206)
at
org.firebirdsql.jdbc.FBStatementFetcher.next(FBStatementFetcher.java:137)
at org.firebirdsql.jdbc.FBResultSet.next(FBResultSet.java:250)
at ...
"
SS error occurs at while(rs2.next()):
"
org.firebirdsql.jdbc.FBSQLException: The result set is closed
at
org.firebirdsql.jdbc.FBResultSet.checkCursorMove(FBResultSet.java:217)
at org.firebirdsql.jdbc.FBResultSet.next(FBResultSet.java:249)
...
"
Now I remembered that you helped me with the last error, saying I
cannot have two resultsets open with autocommit set to true, because
of the JDBC spec.
But I set autocommit to false, as you can see in the snippet, so I
kept on looking and I found, that after the first loop of
while(rs.next()) and while(rs2.next()) autocommit changes automaticly
to true...
But I still don't have an idea why the embedded-specific error occurs,
and the error message doesn't say much either.
Is this a bug, or is this me, or is this both :)
Can you derive something from these errors, or do I need to produce a
test case?
J
The code snippet in my program:
"
...
conn.setAutoCommit(false);
Statement st=conn.createStatement();
Statement st2=conn.createStatement();
String query="select a,lot,of,stuff from a_table where
date>='"+date+"' order by something";
ResultSet rs=st.executeQuery(query);
while(rs.next()) {
do_stuff_that_only_read_from_rs();
query="select some,other,stuff from a_different_table where
id="+idFromFirstQuery;
ResultSet rs2=st2.executeQuery(query);
while(rs2.next()) do_stuff_that_only_read_from_rs2();
}
...
"
if there is no data returned from the first query, I get no problem.
But if there is data returned from the first query, I get an Exception
both with JBIRD1.55 and with JBIRD2.
This code worked beforehand with JBIRD1.55, until I put in the
setAutoCommit(false)!
And this is not all. It seems I get a different error at a different
place with embedded and with ss.
Embedded Error occurs at while(rs.next()) :
"
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic
SQL Error
SQL error code = -504
Cursor
at
org.firebirdsql.jdbc.FBStatementFetcher.fetch(FBStatementFetcher.java:206)
at
org.firebirdsql.jdbc.FBStatementFetcher.next(FBStatementFetcher.java:137)
at org.firebirdsql.jdbc.FBResultSet.next(FBResultSet.java:250)
at ...
"
SS error occurs at while(rs2.next()):
"
org.firebirdsql.jdbc.FBSQLException: The result set is closed
at
org.firebirdsql.jdbc.FBResultSet.checkCursorMove(FBResultSet.java:217)
at org.firebirdsql.jdbc.FBResultSet.next(FBResultSet.java:249)
...
"
Now I remembered that you helped me with the last error, saying I
cannot have two resultsets open with autocommit set to true, because
of the JDBC spec.
But I set autocommit to false, as you can see in the snippet, so I
kept on looking and I found, that after the first loop of
while(rs.next()) and while(rs2.next()) autocommit changes automaticly
to true...
But I still don't have an idea why the embedded-specific error occurs,
and the error message doesn't say much either.
Is this a bug, or is this me, or is this both :)
Can you derive something from these errors, or do I need to produce a
test case?
J