How can I set the current schema for DB2 using Hibernate/JDBC?

All the properties for the 9.7 (Latest) db are here...

https://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=/com.ibm.db2.luw.apdv.java.doc/doc/r0052607.html

use:

currentSchema

Specifies the default schema name that is used to qualify unqualified database objects in dynamically prepared SQL statements. The value of this property sets the value in the CURRENT SCHEMA special register on the database server. The schema name is case-sensitive, and must be specified in uppercase characters.


With DB2 JDBC type 4 driver (com.ibm.db2.jcc.DB2Driver), I'm using this URL to connect :

jdbc:db2://<HOST>:<PORT>/<DATABASE>:currentSchema=<SCHEMA>;

Source: http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/rjvdsprp.htm

Tags:

Db2

Schema

Jdbc