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