-->
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.  [ 3 posts ] 
Author Message
 Post subject: DB2 and hibernate
PostPosted: Tue Jan 03, 2006 4:03 pm 
Newbie

Joined: Tue Jan 03, 2006 3:49 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
hibernate 2.1


I am trying to create a SessionFactory using the following code
[color=orange] public SessionFactory getGvSessionFactory() throws MappingException, HibernateException {
Configuration conf = new Configuration();

conf.setProperty("dialect", "net.sf.hibernate.dialect.DB2Dialect");

conf.setProperty("show_sql","false");

conf.setProperty("hibernate.connection.driver_class","com.ibm.db2.jcc.DB2Driver");

conf.setProperty("hibernate.connection.url","jdbc:db2://url:port/dbname");

conf.setProperty("hibernate.connection.username","****");

conf.setProperty("hibernate.connection.password","*****");

conf.setProperty("hibernate.connection.pool_size","1");

conf.setProperty("hibernate.default_schema", "GLBL_VER");

conf.addResource("com/dcx/hibernate/dto/glblver/Strings.hbm.xml");

SessionFactory sessionFactory = conf.buildSessionFactory();

return sessionFactory;
[/color]
however I get the following

22372 [main] INFO cfg.SettingsFactory - RDBMS: DB2/SUN, version: SQL08022
22372 [main] INFO cfg.SettingsFactory - JDBC driver: IBM DB2 JDBC Universal Driver Architecture, version: 2.3.63
org.hibernate.HibernateException: No DatabaseDialectMapper known for database [DB2/SUN]
at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:62)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:374)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
at com.dcx.util.hibernate.HibernateUtil.getGvSessionFactory(HibernateUtil.java:812)
at com.dcx.imports.cdd.main.CDDImport.main(CDDImport.java:33)


How can I get around this - how do I set a databaseDialectMapper. With the exact same code I do not get this error on another DB2 database. The log shows this output on this other database.
cfg.SettingsFactory - RDBMS: DB2/NT
I am assuming it has something to do with the version of DB2 but I cant figure out how to set the dialect for a DB2/SUN database. Please help.
Thanks
GZ


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 4:05 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You are mixing Hibernate 2.x and Hibernate 3.x, don't do that. Read the migration guide.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 4:13 pm 
Newbie

Joined: Tue Jan 03, 2006 3:49 pm
Posts: 2
I have also tried hibernate 3.1 and changed the following line of code

conf.setProperty("dialect", "net.sf.hibernate.dialect.DB2Dialect");
TO
conf.setProperty("dialect","org.hibernate.dialect.DB2Dialect");

But i still get the same results.


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