B4J Question Firebird JDBC error : The result set is closed (B4J v 2.2)

incendio

Well-Known Member
Licensed User
Longtime User
Hi guys,
I havethese codes :
B4X:
Cursor = Sql.ExecQuery("select * from table where tag = 'N' )
Do While Cursor.NextRow
  Id = Cursor.GetInt("ID")  
  do some process
  Sql.ExecNonQuery("update table set tag = 'Y' where id = " & Id)   
Loop
Cursor.Close
Cursor returns 3 rows, for the first column, it runs ok, the next rows raised an error :
org.firebirdsql.jdbc.FBSQLException: The result set is closed

Did I missed something here? It seem that somehow the command ExecNonQuery closed the cursor, so it is only success for first row.
Thanks in advance.
 

incendio

Well-Known Member
Licensed User
Longtime User
Thanks for you replied.

I managed to fix the error by creating another sql instance.

Change code to these :
B4X:
Cursor = Sql.ExecQuery("select * from table where tag = 'N' )
Do While Cursor.NextRow
  Id = Cursor.GetInt("ID") 
  do some process
  Sql2.ExecNonQuery("update table set tag = 'Y' where id = " & Id)  
Loop
Cursor.Close

Just a little OOT, is this behaviour (new transaction closes current result sets) is the same in B4A?
 
Upvote 0
Top