-->
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.  [ 9 posts ] 
Author Message
 Post subject: Cannot (DB) open connection
PostPosted: Sat Feb 28, 2004 2:57 pm 
Newbie

Joined: Fri Feb 13, 2004 7:57 pm
Posts: 9
Location: Montreal, Canada
Versions: Hibernate 2.1, DB2 V7.2

Hi,

Am not to able to connect to the DB, the DB is setup and runnning, complains of ' no suibale driver found'. the DB2Driver.zip file is in the classpath. As per the logs, the hibernate.properties file is being seen

Would appreciate any leads,
Thanks



###################################
### DB2 Database - Hibernate.properties
###################################
hibernate.connection.driver_class=COM.ibm.db2.jdbc.net.DB2Driver
hibernate.connection.url=jdbc:db2:HIBERXMP
hibernate.connection.username=db2admin
hibernate.connection.password=db2admin
hibernate.default_schema=db2admin
hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect
hibernate.show_sql=true





2004-02-28 13:15:37,799 INFO hibernate.cfg.SettingsFactory -> Use outer join fetching: true
2004-02-28 13:15:37,819 INFO hibernate.connection.DBCPConnectionProvider -> DBCP using driver: COM.ibm.db2.jdbc.net.DB2Driver at URL: jdbc:db2:HIBERXMP
2004-02-28 13:15:37,819 INFO hibernate.connection.DBCPConnectionProvider -> Connection properties: {user=db2admin, password=db2admin}
2004-02-28 13:15:37,889 INFO hibernate.transaction.TransactionManagerLookupFactory -> No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
2004-02-28 13:15:37,889 WARN hibernate.cfg.SettingsFactory -> Could not obtain connection metadata
java.sql.SQLException: No suitable driver


2004-02-28 13:15:38,821 INFO hibernate.impl.SessionFactoryObjectFactory -> no JNDI name configured
User = abc1211
2004-02-28 13:15:39,001 WARN hibernate.util.JDBCExceptionReporter -> SQL Error: 0, SQLState: 08001
2004-02-28 13:15:39,001 ERROR hibernate.util.JDBCExceptionReporter -> No suitable driver
2004-02-28 13:15:39,001 ERROR hibernate.util.JDBCExceptionReporter -> Cannot open connection
java.sql.SQLException: No suitable driver


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 28, 2004 3:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
rename db2driver.zip to db2driver.jar


Top
 Profile  
 
 Post subject: Cannot (DB) open connection
PostPosted: Sat Feb 28, 2004 4:44 pm 
Newbie

Joined: Fri Feb 13, 2004 7:57 pm
Posts: 9
Location: Montreal, Canada
Thanks for your response,

Did rename it to db2java.jar and still have the identical error and log messages. Just to make sure, I removed the reference to db2java.jar from the classpath, this time it reported that the ...db2driver class was not found.

In regard to the log messages:

2004-02-28 13:15:37,889 INFO hibernate.transaction.TransactionManagerLookupFactory -> No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
2004-02-28 13:15:37,889 WARN hibernate.cfg.SettingsFactory -> Could not obtain connection metadata

a. do I need to configure a "TransactionManagerLookup "
b. and what is 'Could not obtain connection metadata ' refering to


Appreciate the help.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 29, 2004 6:35 am 
Newbie

Joined: Fri Feb 13, 2004 7:57 pm
Posts: 9
Location: Montreal, Canada
The 'cannot open connection, 'no suitable driver' problem above, was resolved by using hibernate.connection.driver_class=COM.ibm.db2.jdbc.app.DB2Driver instead of hibernate.connection.driver_class=COM.ibm.db2.jdbc.net.DB2Driver

however, this results in the following error log

2004-02-29 05:08:41,106 INFO hibernate.connection.DBCPConnectionProvider -> DBCP using driver: COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2:hiberxmp
2004-02-29 05:08:41,106 INFO hibernate.connection.DBCPConnectionProvider -> Connection properties: {user=db2admin, password=db2admin}
2004-02-29 05:08:41,316 INFO hibernate.transaction.TransactionManagerLookupFactory -> No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
java.lang.AbstractMethodError: COM.ibm.db2.jdbc.app.DB2DatabaseMetaData.supportsResultSetType(I)Z
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:74)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1091)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:737)
at dbdemo.HibernateDemo.run(HibernateDemo.java:52)
at dbdemo.HibernateDemo.main(HibernateDemo.java:31)
Exception in thread "main"

The code being executed was the following:
cfg =new Configuration()
.addClass(User.class)
.addClass(Contact.class)
.addClass(Book.class)
.addClass(Address.class)
.addProperties(props);

Does hibernate require the hibernate.connection.driver_class=COM.ibm.db2.jdbc.net.DB2Driver

Any feedback would be appreciated,
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 29, 2004 9:09 am 
Newbie

Joined: Mon Dec 22, 2003 10:00 am
Posts: 11
Location: Switzerland
Hi, I think you are using the wrong driver package.
If your are running windows and JDK >= 1.2, you should run (in the db2 directory) SQLLIB/java12/usejdbc12.bat -> it will generate the right db2java.zip in the SQLLIB/java directory.
Regards
Massimo


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 01, 2004 9:50 pm 
Newbie

Joined: Fri Feb 13, 2004 7:57 pm
Posts: 9
Location: Montreal, Canada
Massimo, ..your recommendation worked out just fine !

Thanks,
Martin.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 29, 2004 7:25 pm 
Newbie

Joined: Mon Mar 29, 2004 7:10 pm
Posts: 16
Location: Minneapolis, MN/Topeka, KS
I was having the same problem, found this post, changed db2java.zip to db2java.jar (made sure that I was running Java 1.2 version).

Still no joy.

Mar 29, 2004 5:04:09 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Mar 29, 2004 5:04:10 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 1
Mar 29, 2004 5:04:10 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2://ECP
Mar 29, 2004 5:04:10 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=db2admin, password=db2admin}
Mar 29, 2004 5:04:10 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.2
Mar 29, 2004 5:04:10 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=COM.ibm.db2.jdbc.app.DB2Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.hibernate.cache.HashtableCacheProvider, hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=db2admin, hibernate.connection.url=jdbc:db2://ECP, hibernate.show_sql=true, hibernate.connection.password=db2admin, hibernate.connection.pool_size=1}
Mar 29, 2004 5:04:10 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: using java.io streams to persist binary types
Mar 29, 2004 5:04:10 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Mar 29, 2004 5:04:10 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
Mar 29, 2004 5:04:10 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
Mar 29, 2004 5:04:10 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Mar 29, 2004 5:04:10 PM net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.DB2Dialect
Mar 29, 2004 5:04:10 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximim outer join fetch depth: 1
Mar 29, 2004 5:04:10 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use outer join fetching: true
Mar 29, 2004 5:04:10 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Mar 29, 2004 5:04:10 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 1
Mar 29, 2004 5:04:11 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2://ECP
Mar 29, 2004 5:04:11 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=db2admin, password=db2admin}
Mar 29, 2004 5:04:11 PM net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
Mar 29, 2004 5:04:20 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
WARNING: Could not obtain connection metadata
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:95)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:73)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1119)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:748)
at org.srs.bom.util.TestPerson.main(TestPerson.java:36)
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:95)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:73)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1119)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:748)
at org.srs.bom.util.TestPerson.main(TestPerson.java:36)
Mar 29, 2004 5:04:20 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: false
Mar 29, 2004 5:04:20 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use JDBC3 getGeneratedKeys(): false
Mar 29, 2004 5:04:20 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
Mar 29, 2004 5:04:20 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: echoing all SQL to stdout
Mar 29, 2004 5:04:20 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {no='N', true=1, yes='Y', false=0}
Mar 29, 2004 5:04:20 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.hibernate.cache.HashtableCacheProvider
Mar 29, 2004 5:04:20 PM net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
Mar 29, 2004 5:04:21 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Mar 29, 2004 5:04:21 PM net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: no JNDI name configured
Mar 29, 2004 5:04:21 PM net.sf.hibernate.cache.UpdateTimestampsCache <init>
INFO: starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
Mar 29, 2004 5:04:21 PM net.sf.hibernate.cache.QueryCache <init>
INFO: starting query cache at region: net.sf.hibernate.cache.QueryCache
Mar 29, 2004 5:04:21 PM net.sf.hibernate.cfg.Configuration addClass
INFO: Mapping resource: org/srs/bom/Person.hbm.xml
Mar 29, 2004 5:04:22 PM net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: org.srs.bom.Person -> ECP.PERSON


------------Properties follows--------------

## DB2
hibernate.connection.driver_class=COM.ibm.db2.jdbc.app.DB2Driver
hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect
hibernate.connection.url=jdbc:db2://ECP
hibernate.connection.username=db2admin
hibernate.connection.password=db2admin

_________________
Michael McConnell


Top
 Profile  
 
 Post subject: Smoke in the Cockpit
PostPosted: Tue Mar 30, 2004 9:52 am 
Newbie

Joined: Mon Mar 29, 2004 7:10 pm
Posts: 16
Location: Minneapolis, MN/Topeka, KS
Sorry -- Please ignore the last post. There was an error in my JDBC url declaration.

Color me red.

Michael

_________________
Michael McConnell


Top
 Profile  
 
 Post subject: db2java file size
PostPosted: Fri Apr 16, 2004 10:58 am 
Newbie

Joined: Fri Apr 16, 2004 8:49 am
Posts: 3
Hi, i experience some pb too, and i've tried many different db2java files but none worked. I saw that there are many versions available, which size and creation date has your file?

i tried with these one:
1110 kb
1113 kb
1330 kb
1417 kb

Not sure this will help me but never know.

Thanks
Fab.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.