-->
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.  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: DB2 driver not found
PostPosted: Tue Jun 22, 2004 3:13 pm 
Newbie

Joined: Tue Jun 22, 2004 2:02 pm
Posts: 4
Just begin to try to use hibernate with DB2 8.1.
Copied the db2java.zip to the place of classpath, but still
get the error message, saying driver class not found (it is
inside the zip file), what's wrong?

13:46:09,723 INFO Environment:462 - Hibernate 2.1.3
13:46:09,743 INFO Environment:496 - loaded properties from resource hibernate.properties: {hibernate.connection.username=db2admin , hibernate.connection.password=db2admin , hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=cirrus.hibernate.sql.DB2Dialect, hibernate.connection.url=jdbc:db2:empl , hibernate.connection.driver_class=COM.ibm.db2.jdbc.app.DB2Driver }
13:46:09,743 INFO Environment:519 - using CGLIB reflection optimizer
13:46:09,743 INFO Environment:530 - JVM does not support Statement.getGeneratedKeys()
13:46:09,743 INFO Environment:541 - JVM does not support LinkedHasMap, LinkedHashSet - ordered maps and sets disabled
13:46:09,743 INFO Environment:544 - using workaround for JVM bug in java.sql.Timestamp
13:46:09,773 INFO Configuration:347 - Mapping resource: com/ibm/hibernate_article/Employee.hbm.xml
13:46:11,305 INFO Binder:229 - Mapping class: com.ibm.hibernate_article.Employee -> employee
13:46:11,425 INFO Configuration:347 - Mapping resource: com/ibm/hibernate_article/Department.hbm.xml
13:46:12,056 INFO Binder:229 - Mapping class: com.ibm.hibernate_article.Department -> department
13:46:12,056 INFO Configuration:613 - processing one-to-many association mappings
13:46:12,056 INFO Configuration:622 - processing one-to-one association property references
13:46:12,056 INFO Configuration:647 - processing foreign key constraints
13:46:12,106 WARN SettingsFactory:50 - No dialect set - using GenericDialect: Dialect class not found: cirrus.hibernate.sql.DB2Dialect
13:46:12,106 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.GenericDialect
13:46:12,146 INFO SettingsFactory:62 - Use outer join fetching: false
13:46:12,146 INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use!)
13:46:12,146 INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 20
13:46:12,156 FATAL DriverManagerConnectionProvider:62 - JDBC Driver class not found: COM.ibm.db2.jdbc.app.DB2Driver
net.sf.hibernate.HibernateException: JDBC Driver class not found: COM.ibm.db2.jdbc.app.DB2Driver
at net.sf.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:63)
at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:83)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:64)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1132)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:766)
at HBTest.main(HBTest.java:42)


Top
 Profile  
 
 Post subject: Follow up: I am using WSAD
PostPosted: Tue Jun 22, 2004 3:42 pm 
Newbie

Joined: Tue Jun 22, 2004 2:02 pm
Posts: 4
By the way, I am using WSAD and what I did was that I imported
all the jar files, zip files into a java project and all these jars/zip files
are on the classpath. Then I just run a very simple code (main method)
that uses hibernate stuff.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 22, 2004 4:44 pm 
Newbie

Joined: Tue Jun 22, 2004 2:02 pm
Posts: 4
I now swtich to MySQL, also run outside WSAD, wtith command line,
with db2java.zip and mysql-connector-java-3.0.14-production.zip
on the classpath, Got the same result, reporting mysql driver not found.
Any tips?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 09, 2004 3:57 pm 
Newbie

Joined: Fri Aug 06, 2004 4:48 pm
Posts: 8
How did you resolve the issues? could you please post a tip? I'd an exact problem, and tried everything. My db2java.zip and db2jcc.jar ARE in classpath, seperately. I always got "JDBC Driver Class Not Found: COM.ibm.db2.jdbc.apps.DB2Driver".

Any help is greatly appreciated!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 09, 2004 4:59 pm 
Beginner
Beginner

Joined: Thu Jul 22, 2004 2:15 pm
Posts: 35
What driver are you guys using for DB2? it seems more of a driver issue than hibernate.

I use db2jcc.jar and use com.ibm.db2.jcc.DB2Driver as the class

I think for db2java.zip it is the class that tomyan used : COM.ibm.db2.jdbc.apps.DB2Driver

Difference between these two drivers is that COM.ibm.db2.jdbc.apps.DB2Driver is what they call app server, uses the cli to interact with the database. So its not completely portable. And you will need db2java.zip, and sqlj.zip, and runtime.zip


com.ibm.db2.jcc.DB2Driver is a Type 4 driver, all java, portable. For this driver, db2jcc.jar should be sufficient.

HTH

_________________
--------------------------------------------------
To code or not to code... Is that a question?
--------------------------------------------------
Pritpal Dhaliwal


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 09, 2004 6:37 pm 
Newbie

Joined: Fri Aug 06, 2004 4:48 pm
Posts: 8
You are probably right about the JDBC Driver. I changed it to COM.ibm.db2.jcc.DB2Driver, but still got the same error:
JDBC Driver class not found: COM.ibm.db2.jcc.DB2Driver

Obviously, the system would not recognize the db2jcc.jar file which is located in the lib directory (it can be seen by "set classpath" command.)

Any suggestions? Very appreciated!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 10, 2004 1:10 am 
Newbie

Joined: Sat Aug 07, 2004 4:23 pm
Posts: 4
For some strange reason IBM decided to change the package name it is now com.ibm.db2.jcc.DB2Driver (lowercase COM). Also I think you will need to have the db2jcc_license_cu.jar or the other license jar in your classpath otherwise it will throw an exception when you try to connect.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 10, 2004 8:51 am 
Newbie

Joined: Fri Aug 06, 2004 4:48 pm
Posts: 8
Yes, two little things that caused JDBCD Driver Class Not Found:

Package name: should be com.ibm.db2.jcc.DB2Driver, not
COM.ibm.db2.jdbc.app.DB2Driver - for NON-Container based applications.

You certainly would like to spend your time on more important things. Thanks XCM!

Now, the error becomes:

net.sf.hibernate.JDBCException: Cannot open connection
...
Caused by: com.ibm.db2.jcc.c.SqlException: Failure in loading T2 native library db2jcct2.

This is for Windows 2000, DB2 7.2, hibernate WITHOUT containers. I've db2jcc.zip, db2jcc_license_cu.jar, sqlj.zip in my lib directory and classpathed. Does anybody know what else are missing?

Thanks a lot!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 18, 2008 12:41 am 
Newbie

Joined: Fri Jan 18, 2008 12:14 am
Posts: 2
Location: Australia
I'm getting this same "com.ibm.db2.jcc.c.SqlException: Failure in loading T2 native library db2jcct2" error when I try to run Hibernate Code Generation. How did you solve it?

My Hibernate Configurations view in Eclipse shows the database and tables correctly, so I think my hibernate.cfg.xml file has the correct database settings.

- Jaysen


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 18, 2008 2:31 am 
Newbie

Joined: Fri Jan 18, 2008 12:14 am
Posts: 2
Location: Australia
Ahah! Found that I'd specified a properties file as well as the cfg file. removing the properties file fixed it.

- Jaysen


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 16, 2008 3:56 am 
Newbie

Joined: Wed Dec 10, 2008 5:45 am
Posts: 4
I am getting the same error as below,
net.sf.hibernate.JDBCException: Cannot open connection
My code looks like,

try {
cfg = new Configuration()
.setProperty("hibernate.order_updates", "true")
.setProperty("hibernate.connection.driver_class", "com.ibm.db2.jcc.DB2Driver")
.setProperty("hibernate.connection.url", "jdbc:db2:" + DATABASE)
.setProperty("hibernate.connection.username", USER)
.setProperty("hibernate.connection.password", PASSWORD)
.setProperty("hibernate.dialect", "net.sf.hibernate.dialect.DB2Dialect")
.setProperty("hibernate.cglib.use_reflection_optimizer", "false");
} catch (MappingException e) {
e.printStackTrace();
System.exit(1);
}
Anybody plz help me what is causing this issue. In my case there is no properties file.

Thanks,
-Anil


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 16, 2008 4:19 am 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
manil22 wrote:
I am getting the same error as below,
net.sf.hibernate.JDBCException: Cannot open connection
My code looks like,

try {
cfg = new Configuration()
.setProperty("hibernate.order_updates", "true")
.setProperty("hibernate.connection.driver_class", "com.ibm.db2.jcc.DB2Driver")
.setProperty("hibernate.connection.url", "jdbc:db2:" + DATABASE)
.setProperty("hibernate.connection.username", USER)
.setProperty("hibernate.connection.password", PASSWORD)
.setProperty("hibernate.dialect", "net.sf.hibernate.dialect.DB2Dialect")
.setProperty("hibernate.cglib.use_reflection_optimizer", "false");
} catch (MappingException e) {
e.printStackTrace();
System.exit(1);
}
Anybody plz help me what is causing this issue. In my case there is no properties file.

Thanks,
-Anil


Could you post your error stacktrace?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 16, 2008 4:54 am 
Newbie

Joined: Wed Dec 10, 2008 5:45 am
Posts: 4
This exception is coming on Test Site. There is no permission for me to access this server. I'm seeing this error in my console. Application Error
net.sf.hibernate.JDBCException: Cannot open connection


Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 16, 2008 4:59 am 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
manil22 wrote:
This exception is coming on Test Site. There is no permission for me to access this server. I'm seeing this error in my console. Application Error
net.sf.hibernate.JDBCException: Cannot open connection


Thanks.


It's difficult to know the problem, should see the stack trace.

http://www.google.com.sg/search?q=Cannot+open+connection+%2B+hibernate&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 16, 2008 11:10 am 
Newbie

Joined: Wed Dec 10, 2008 5:45 am
Posts: 4
Here is the stack trace,

Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.kroger.security.actions.KrogerSecureStrutsDispatchAction.dispatchAction(KrogerSecureStrutsDispatchAction.java:95)
... 27 more
Caused by: net.sf.hibernate.JDBCException: Cannot open connection
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:281)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3297)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3277)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704)
at net.sf.hibernate.hql.QueryTranslator.iterate(QueryTranslator.java:844)
at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1601)
at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1574)
at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1566)
at com.kroger.accounting.rem.bean.Criteria.count(Criteria.java:607)
at com.kroger.accounting.rem.struts.actions.SearchLeasesAction.performSearch(SearchLeasesAction.java:243)
... 32 more
Caused by: com.ibm.db2.jcc.a.SqlException: Failure in loading T2 native library db2jcct2
at com.ibm.db2.jcc.t2.a.a(a.java:31)
at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(T2Configuration.java:75)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:194)
at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:181)
at java.sql.DriverManager.getConnection(DriverManager.java:572)
at java.sql.DriverManager.getConnection(DriverManager.java:165)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:101)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1132)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:766)
at com.kroger.accounting.rem.batch.dao.HibService.<init>(HibService.java:297)
at com.kroger.accounting.rem.batch.dao.HibService.getHibService(HibService.java:346)
at com.kroger.accounting.rem.batch.dao.HibService$1.initialValue(HibService.java:329)
at java.lang.ThreadLocal$ThreadLocalMap.getAfterMiss(ThreadLocal.java:389)
at java.lang.ThreadLocal$ThreadLocalMap.get(ThreadLocal.java:362)
at java.lang.ThreadLocal$ThreadLocalMap.access$000(ThreadLocal.java:240)
at java.lang.ThreadLocal.get(ThreadLocal.java:142)
at com.kroger.accounting.rem.batch.dao.HibService.getSession(HibService.java:358)
... 33 more


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

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.