1

On our production application we recently become weird error from DB2:

Caused by: com.ibm.websphere.ce.cm.StaleConnectionException: [jcc][t4][2055][11259][4.13.80] The database manager is not able to accept new requests, has terminated all requests in progress, or has terminated your particular request due to an error or a force interrupt. ERRORCODE=-4499, SQLSTATE=58009

This occurs when hibernate tries to select data from one big table(More than 6 milions records and 320 columns). I observed that when ResultSet lower that 10 elements, hibernate selects successfully.

Our architecture:

  • Spring 4.0.3
  • Hibernate 4.3.5
  • DB2 v10 z/Os
  • Websphere 7.0.0.31(with JDBC V9.7FP5)

This select works when I tried to executed this in Data Studio or when app is started localy from Tomcat(connected to production Data Source). I suppose that Data Source on Websphere is not corectly configured, but I tried some modifications and without results. I also tried to update JDBC Driver but that not helped. Actually I become then ERRORCODE = -1244.

Ok, so now I'm looking for any help ;). I can obviously provide additional information when needed. Maybe someone fighted earlier with this problem?

Thanks in advance!

6
  • May be the workload manager terminates the query in question because it exceeds some resource threshold. Talk to your DBA.
    – mustaccio
    Nov 19, 2014 at 12:59
  • My DBA said that query looks good in Querymonitor and did't log anything strange Nov 19, 2014 at 13:26
  • May be timeout error, how about setting transaction timeout value to higher value in websphere ?
    – zawhtut
    Nov 19, 2014 at 14:37
  • But you mean transaction timeout for Data Source or whole WebContainer? Nov 19, 2014 at 22:40
  • For the Data Source.
    – zawhtut
    Nov 20, 2014 at 6:07

2 Answers 2

1

We have the same problem and finally solved by running REORG and RUNSTAT on the table(s). In our case, databse and tables were damaged and after running both mentioned operations, it resolved.

0

This occurs when hibernate tries to select data from one big table(More than 6 milions records and 320 columns)

6 million records with 320 columns seems huge to be read at once through hibernate. How you tried creating a database cursor and streaming few records at a time? In plain JDBC it is done as follows

Statement stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
                java.sql.ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(50); //fetch only 50 records at a time

while with hibernate you would need the below code

Query query = session.createQuery(query);
query.setReadOnly(true);
query.setFetchSize(50);
ScrollableResults results = query.scroll(ScrollMode.FORWARD_ONLY);
// iterate over results
while (results.next()) {
    Object row = results.get();
    // process row then release reference
    // you may need to flush() as well
}
results.close();

This allows you to stream over the result set, however Hibernate will still cache results in the Session, so you’ll need to call session.flush() every so often. If you are only reading data, you might consider using a StatelessSession, though you should read its documentation beforehand.

Analyze the database table locking impact when using this approach.

1
  • We use DB2 JDBC from IBM, so I suppose that this configuration JDBC takes from Data Source.I find in my Data Source configuration that our ScrollMode now is default so: TYPE_SCROLL_SENSITIVE_STATIC. Alternatives are: TYPE_SCROLL_SENSITIVE_DYNAMIC or TYPE_SCROLL_ASENSITIVE. What exactly means this sensitive property here? Nov 20, 2014 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.