DB2 10.5 for Linux, UNIX, and Windows

Setting the DB2 for z/OS application compatibility for your JDBC and SQLJ applications

You can set the DB2® for z/OS® application compatibility for Java™ applications by specifying a bind option for static applications, or a special register for dynamic applications.

About this task

Starting with DB2 for z/OS Version 11, you can choose whether to use SQL behavior that is available in new-function mode of the new DB2 for z/OS version, or continue to use SQL behavior from the previous version. This feature is called application compatibility. You can set the application compatibility level for an entire DB2 for z/OS subsystem, or for individual application packages.

The IBM® Data Server Driver for JDBC and SQLJ provides several ways to set the application static SQLJ applications or for dynamic JDBC or SQLJ applications.

Procedure

To set the application compatibility for Java applications, follow one of these procedures.

Examples

Example: In a JDBC application that uses the DriverManager interface, set the application compatibility to V11R1 in the connection URL.

String url = 
     "jdbc:db2://sysmvs1.svl.ibm.com:5021/STLEC1" +
     ":user=dbadm;password=dbadm;" +
     "specialRegisters=CURRENT APPLICATION COMPATIBILITY='V11R1'" + ";";
    Connection con = 
       java.sql.DriverManager.getConnection(url);

Example: In a JDBC application that uses the DataSource interface, set the application compatibility to V10R1 using the setSpecialRegisters method.

DB2DataSource ds = new DB2DataSource();
…
Properties prop = new Properties();
prop.add("CURRENT APPLICATION COMPATIBILITY","V10R1");
…
ds.setSpecialRegisters(prop);

Example: Customize and bind the package for serialized profile EzSqlj_SJProfile0.ser so that the application is compatible with DB2 for z/OS Version 10.

db2sqljcustomize -user myid -password mypw
     -url jdbc:db2://sysmvs1.stl.ibm.com:5021/STLEC1
     -bindoptions "APPLCOMPAT(V10R1)" EzSqlj_SJProfile0.ser

Example: Rebind packages EZSQLJ01, EZSQLJ02, EZSQLJ03, and EXSQLJ04 for serialized profile EzSqlj_SJProfile0.ser so that the application is compatible with DB2 for z/OS Version 11.

java com.ibm.db2.jcc.DB2Binder
     -url jdbc:db2://sysmvs1.stl.ibm.com:5021/STLEC1 -user myid -password mypw
     -bindoptions "APPLCOMPAT V11R1" -generic -action rebind -collection mycoll
     -package EZSQLJ01
java com.ibm.db2.jcc.DB2Binder
     -url jdbc:db2://sysmvs1.stl.ibm.com:5021/STLEC1 -user myid -password mypw
     -bindoptions "APPLCOMPAT V11R1" -generic -action rebind -collection mycoll
     -package EZSQLJ02
java com.ibm.db2.jcc.DB2Binder
     -url jdbc:db2://sysmvs1.stl.ibm.com:5021/STLEC1 -user myid -password mypw
     -bindoptions "APPLCOMPAT V11R1" -generic -action rebind -collection mycoll
     -package EZSQLJ03
java com.ibm.db2.jcc.DB2Binder
     -url jdbc:db2://sysmvs1.stl.ibm.com:5021/STLEC1 -user myid -password mypw
     -bindoptions "APPLCOMPAT V11R1" -generic -action rebind -collection mycoll
     -package EZSQLJ04