-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Connection problems with Hibernate 5.0.2 and DB2 z/OS v11
PostPosted: Thu Oct 29, 2015 6:12 am 
Newbie

Joined: Thu Oct 29, 2015 5:18 am
Posts: 3
We use Tomcat DBCP with validation query, db2jcc4.jar and DB2 v11 z/OS
While testing the migration from Hibernate 3.3.2 to Hibernate 5.0.2 we had mysterious (non-deterministic) SQLErrors:

org.hibernate.engine.jdbc.spi.SqlExceptionHelper - [jcc][t4][2030][11211][4.14.137] Bei Operationen auf dem der Verbindung zugrunde liegendem Socket, im Socketeingabedatenstrom oder Socketausgabedatenstrom ist ein Kommunikationsfehler aufgetreten. Fehlerposition: T4Agent.sendRequest() - flush (-1). Nachricht: Connection reset. ERRORCODE=-4499, SQLSTATE=08001

Our db2 admins analyzed their db2 logfiles. They said the following statement causes the problem:
DECLARE GLOBAL TEMPORARY TABLE ... NOT LOGGED
 
This statement is defined in DB2Dialect (we use DB2390Dialect).

This statement creates db2-threads that hold locks for some minutes until they are killed.
The db2 documentation says an explicit DROP TABLE statement must follow or the DECLARE statement has to be defined with ON COMMIT DROP TABLE clause.

My solution:
Code:
public class MyTemporaryTableBulkIdStrategy extends GlobalTemporaryTableBulkIdStrategy {

  public MyTemporaryTableBulkIdStrategy() {
    super(new IdTableSupportStandardImpl() {
      @Override
      public String generateIdTableName(String baseName) {
        return "session." + super.generateIdTableName(baseName);
      }

      @Override
      public String getCreateIdTableCommand() {
        return "declare global temporary table";
      }

      @Override
      public String getCreateIdTableStatementOptions() {
        return "not logged on commit drop table";
      }
    }, AfterUseAction.CLEAN);
  }


and configuration in persistence.xml via property:
<property name="hibernate.hql.bulk_id_strategy" value="...MyTemporaryTableBulkIdStrategy" />

My questions:
- Do you think this is the correct solution oder do you recommend another solution?
- Why doesn't Hibernate use the "ON COMMIT DROP TABLE" clause (at least within DB2390Dialect)?
Thank you for any hints!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.