DB2 Version 9.7 for Linux, UNIX, and Windows

SQLJ differences between the IBM Data Server Driver for JDBC and SQLJ and other DB2 JDBC drivers

The IBM® Data Server Driver for JDBC and SQLJ differs in a number of ways from older JDBC drivers. When you move to the IBM Data Server Driver for JDBC and SQLJ, you need to modify your SQLJ programs to account for those differences.

SQLJ support in the IBM Data Server Driver for JDBC and SQLJ differs from SQLJ support in the other DB2® JDBC drivers in the following areas:

db2sqljcustomize errors and the -collection parameter

The db2sqljcustomize utility that is part of the IBM Data Server Driver for JDBC and SQLJ has a -collection parameter. The db2profc utility that is part of the DB2 JDBC Type 2 Driver does not have a -collection parameter. If the db2sqljcustomize utility performs a bind operation on a DB2 for z/OS® server, and the -collection parameter contains any lowercase characters, db2sqljcustomize returns a -4499 error because collection IDs cannot contain lowercase characters in DB2 for z/OS. This situation cannot occur with db2profc.

Differences in serialized profiles

The DB2 JDBC Type 2 Driver and the IBM Data Server Driver for JDBC and SQLJ produce different binary code when you execute their SQLJ translator and the SQLJ customizer utilities. Therefore, SQLJ applications that you translated and customized using the DB2 JDBC Type 2 Driver sqlj and db2profc utilities do not run under the IBM Data Server Driver for JDBC and SQLJ. Before you can run those SQLJ applications under the IBM Data Server Driver for JDBC and SQLJ, you must retranslate and recustomize the applications using the IBM Data Server Driver for JDBC and SQLJ sqlj and db2sqljcustomize utilities. You must do so even if you have not modified the applications.

SQL VALUES support

The DB2 JDBC Type 2 Driver supports the SQL VALUES statement in an SQLJ statement clause, but the IBM Data Server Driver for JDBC and SQLJ does not. Therefore, you need to modify your SQLJ applications that include VALUES statements.

Example: Suppose that an SQLJ program contains the following statement:
#sql [ctxt] hv = {VALUES (MY_ROUTINE(1))};
For the IBM Data Server Driver for JDBC and SQLJ, you need to change that statement to something like this:
#sql [ctxt] {SELECT MY_ROUTINE(1) INTO :hv FROM SYSIBM.SYSDUMMY1};

Difference in connection techniques

The connection techniques that are available, and the driver names and URLs that are used for those connection techniques, vary from driver to driver. See "Connect to a data source using SQLJ" for more information.

Support for scrollable and updatable iterators

SQLJ with the IBM Data Server Driver for JDBC and SQLJ supports scrollable and updatable iterators.

The DB2 JDBC Type 2 Driver for Linux, UNIX and Windows (DB2 JDBC Type 2 Driver) supports scrollable cursors but not updatable iterators.

Dynamic execution of SQL statements under WebSphere Application Server

For WebSphere® Application Server Version 5.0.1 and above, if you customize your SQLJ program, SQL statements are executed statically.

Alternative names for db2sqljcustomize and db2sqljprint are not supported

The DB2 JDBC Type 2 Driver originally used the name db2profc for the SQLJ profile customizer command, and the name db2profp for the SQLJ profile printer command. For the IBM Data Server Driver for JDBC and SQLJ, the SQLJ profile customizer command is named db2sqljcustomize, and the SQLJ profile printer command is named db2sqljprint. In previous releases of DB2 for Linux, UNIX, and Windows, db2profc was accepted as an alternative name for db2sqljcustomize, and db2profp was accepted as an alternative name for db2sqljprint. These alternative names are no longer accepted.