JDBC, Informix and commit
Posted in 1999
Topics: Connectivity: ODBC / JDBC / .NET, Java & JDBC Development
Has anyone ever seen this before? This is the first time i am using informix, but not the first time i am using JDBC/Java. I have a result set from a select query. Depending on the data in that row, i want to update another table. I want to commit every 100 rows. So, what happens is after i do the commit, I get an sql exception saying that the cursor is closed and i cannot process the rest of my data. if i wait and commit at the end (after i'm done with the result set), everything is fine. But, if there are many rows, memory usage can be a problem. Has anyone seen this and gotten around it? any help is much appreciated. jae park Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.
Yes, I've run into the same problem. I think it may depend on the JDBC driver. I use the type 4 driver supplied by Informix. You can call Connection.getMetaData().supportsOpenCursorsAcrossCommit() or Connection.getMetaData().supportsOpenStatementsAcrossCommit() to test your driver(s). I could not find a workaround within the limitations of JDBC. You may need to find a different way to handle the transaction. Perhaps it could be done in a stored procedure. Good luck, Jeff jpark2317@my-deja.com wrote: >Has anyone ever seen this before? This is the first time i am using >informix, but not the first time i am using JDBC/Java. > >I have a result set from a select query. Depending on the data >in that row, i want to update another table. I want to commit >every 100 rows. > >So, what happens is after i do the commit, I get an sql exception >saying that the cursor is closed and i cannot process the rest of my >data. > >if i wait and commit at the end (after i'm done with the result set), >everything is fine. But, if there are many rows, memory usage can be a >problem. > >Has anyone seen this and gotten around it? > >any help is much appreciated. > >jae park > > >Sent via Deja.com http://www.deja.com/ >Share what you know. Learn what you don't.