-->
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.  [ 2 posts ] 
Author Message
 Post subject: DB2 Hibernate question
PostPosted: Fri Oct 17, 2008 10:36 pm 
Newbie

Joined: Fri Oct 17, 2008 5:08 pm
Posts: 2
Hope this is something simple. When I use the following Hibernate configuration to connect to DB2,

Code:
<hibernate-configuration>
    <session-factory>
        <!-- properties -->
        <property name="connection.driver_class">COM.ibm.db2.jdbc.app.DB2Driver</property>
        <property name="connection.url">jdbc:db2:db456</property>
        <property name="connection.username">dbuser</property>
        <property name="connection.password">dbpasswd</property>
        <property name="dialect">org.hibernate.dialect.DB2Dialect</property>
        <property name="default_schema">testdb1</property>
        <property name="show_sql">false</property>



(I’ve omitted the rest of the file for brevity)

…and include db2java-7.1..jar and sqlj-1.3.1.jar on the classpath, I get this Exception:

Code:
java.lang.AbstractMethodError: COM.ibm.db2.jdbc.app.DB2DatabaseMetaData.supportsResultSetType(I)Z
                at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:80)
                at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
                at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
                at com.cme.clearing.persistence.hibernate.HibernateDAO.newSessionFactory(HibernateDAO.java:392)
                at com.cme.clearing.persistence.hibernate.HibernateDAO.getSessionFactory(HibernateDAO.java:365)
                at com.cme.clearing.persistence.hibernate.HibernateDAO.<init>(HibernateDAO.java:60)
                at com.cme.settlement.svoploader.BaseDAO.<init>(BaseDAO.java:54)
                at com.cme.settlement.svoploader.RunCycleDAO.<init>(RunCycleDAO.java:23)
                at com.cme.settlement.svoploader.Loader.initializeDAOs(Loader.java:23)
                at com.cme.settlement.svoploader.Loader.run(Loader.java:60)
                at com.cme.settlement.svoploader.Loader.main(Loader.java:136)


Seems like a driver issue, right? OK, O I switch to the Type 4 driver:

Code:
<hibernate-configuration>
    <session-factory>
        <!-- properties -->
        <property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
        <property name="connection.url">jdbc:db2:db456</property>
        <property name="connection.username">dbuser</property>
        <property name="connection.password">dbpasswd</property>
        <property name="dialect">org.hibernate.dialect.DB2Dialect</property>
        <property name="default_schema">testdb1</property>
        <property name="show_sql">false</property>



(I’ve omitted the rest of the file for brevity)

…and include db2jcc-8.1.jar, db2jcc_license_cisuz-8.1.jar, and db2jcc_license_cu-8.1.jar on the classpath, I get this Exception:

Code:
com.cme.settlement.svoploader.InitializationException: Could not verify DB connectivity for DAO configured using hib file hibernate.cme.cfg.xml. Possible problem with Datasource in file.
                at com.cme.settlement.svoploader.Loader.testDAOs(Loader.java:42)
                at com.cme.settlement.svoploader.Loader.run(Loader.java:66)
                at com.cme.settlement.svoploader.Loader.main(Loader.java:136)
Caused by: com.cme.clearing.persistence.DataAccessException: Error while attempt to retrieve a raw sql connection.
                at com.cme.clearing.persistence.hibernate.HibernateDAO.getConnection(HibernateDAO.java:216)
                at com.cme.settlement.svoploader.BaseDAO.test(BaseDAO.java:119)
                at com.cme.settlement.svoploader.Loader.testDAOs(Loader.java:39)
                ... 2 more
Caused by: com.ibm.db2.jcc.b.SQLException: Unable to load T2 native library.  Type 2 JDBC architecture is not yet supported by the IBM DB2 JDBC Universal Driver Architecture
                at com.ibm.db2.jcc.t2.T2Configuration.a(T2Configuration.java:62)
                at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(T2Configuration.java:39)
                at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:261)
                at java.sql.DriverManager.getConnection(DriverManager.java:525)
                at java.sql.DriverManager.getConnection(DriverManager.java:140)
                at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
                at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
                at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
                at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
                at com.cme.clearing.persistence.hibernate.HibernateDAO.newSessionFactory(HibernateDAO.java:392)
                at com.cme.clearing.persistence.hibernate.HibernateDAO.getSessionFactory(HibernateDAO.java:365)
                at com.cme.clearing.persistence.hibernate.HibernateDAO.<init>(HibernateDAO.java:60)
                at com.cme.settlement.svoploader.BaseDAO.<init>(BaseDAO.java:54)
                at com.cme.settlement.svoploader.RunCycleDAO.<init>(RunCycleDAO.java:23)
                at com.cme.settlement.svoploader.Loader.initializeDAOs(Loader.java:23)
                at com.cme.settlement.svoploader.Loader.run(Loader.java:60)
                ... 1 more


Has anyone experienced this before? What did you do to fix it?


Top
 Profile  
 
 Post subject: UPDATE: DB2 Hibernate issue
PostPosted: Mon Oct 20, 2008 3:00 pm 
Newbie

Joined: Fri Oct 17, 2008 5:08 pm
Posts: 2
I have made some progress with this issue. Basically, it has to do with the version of the DB2 client that is installed on my computer. Although I have included the JAR file that includes the type 4 driver in my class path, it apparently also needs to be set in the system class path. I happen to be developing on a Windows PC, so DB2 uses some dynamic link libraries (DLLs) in addition to the JARs.

The solution in my case was to upgrade to a new DB2 client that included the necessary JARs and DLLs. The installation updated the system classpath as well.


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

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.