My apologies, as this may seem more of a JDBC question than a Hibernate one, but I'm grasping at straws here.
I'm having a problem using a combination of Hibernate and JDBC code. More specifically, I have a process, based on Hibernate, that loads a bunch of data. I have another process, based on JDBC, that essentially performs maintenance on this data. I get a DB2 function sequence error when the following happens:
- Load the data through the Hibernate-based process. This always completes normally.
- Run the JDBC-based maintenance process shortly after the Hibernate-based process completes. This process is new and runs in two threads. One thread will complete normally. The other thread will spew the function sequence error.
The odd part is that if I restart the application server, and run the maintenance process over the same data set that previously crashed, the whole thing completes normally. I have noticed that different cursors over the database will be used for the two-threaded process when restarting the app server (i.e., the successful run), versus just one being used when not restarting (i.e., the unsuccessful run). The function sequence error happens when iterating through a ResultSet, on the second invocation of ResultSet.next() of the JDBC process.
I heavily suspect that this may be a DB2 JDBC bug of some kind, since we don't see any of these errors running a production application that uses the same Hibernate-based load process, with many users querying the data while the load runs and after it completes. However, it seems as if a cursor used in the database is not closed from the Hibernate-based process, which causes one of the threads running the JDBC-based process to error out. The process will not error out when running the JDBC-based process back to back after restarting the app server when the Hibernate-based load process completes.
Let me know if you would like to see the code from either/both processes or any Hibernate configuration. We also have a ticket open with IBM looking into any DB2 problems that may be happening. Thanks in advance for your help.
------------------------------------------------------------------------------------
Our system:
- WebSphere 4.0
- AIX 4.3
- Java 1.3.1
- COM.ibm.db2.jdbc.DB2XADataSource
- DB2 version 7.2.5
------------------------------------------------------------------------------------
The stack trace:
[2/11/04 11:05:00:176 EST] 33c044ee SystemOut U 2004-02-11 11:05:00,157,ERROR,SQL error happened in DirectiveDAOJdbcImpl.
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0125E Function sequence error. SQLSTATE=HY010
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java(Compiled Code))
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java(Inlined Compiled Code))
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java(Inlined Compiled Code))
at COM.ibm.db2.jdbc.app.DB2ResultSet.next(DB2ResultSet.java(Compiled Code))
at com.ibm.ejs.cm.proxy.ResultSetProxy.next(ResultSetProxy.java(Compiled Code))
at com.borders.invmgmt.retrieve.dao.jdbc.DirectiveDAOJdbcImpl.maintainDirectiveStati(DirectiveDAOJdbcImpl.java(Compiled Code))
at com.borders.invmgmt.retrieve.schedule.job.ConvertSchedule.execute(ConvertSchedule.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:147)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java(Compiled Code))
|