I am writing an application that can connect to SQL Server, Oracle, DB2 LUW, and DB2 z/OS. I have the first three working fine. The only thing I change is the hibernate.cfg.xml file and I am able to switch databases. However, DB2 z/OS doesn't work. I am able to connect to the DB2 Subsytem, but it appears I am trying to create the table in DB2's default database (DSNDB04). I get the following message:
DB2 SQL Error: SQLCODE=-551, SQLSTATE=42501, SQLERRMC=USER1;CREATE TABLE;DSNDB04, DRIVER=3.57.82
The problem is that you specify the DB2 Subsystem name not the database name (like you do on the others) on the connection.url property. Below are the connection related properties I have specified in
hibernate.cfg.xml:
Code:
<property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
<property name="connection.url">jdbc:db2://my.company.com:1234/DB2SBSYS</property>
<property name="connection.username">USER1</property>
<property name="connection.password">PW</property>
<property name="dialect">org.hibernate.dialect.DB2390Dialect</property>
How do I specify the database name?