DB2 Version 9.7 for Linux, UNIX, and Windows

Named parameter markers in JDBC applications

You can use named parameter markers instead of standard parameter markers in PreparedStatement and CallableStatement objects to assign values to the input parameter markers. You can also use named parameter markers instead of standard parameter markers in CallableStatement objects to register OUT parameters that have named parameter markers.

SQL strings that contain the following SQL elements can include named parameter markers:

Named parameter markers make your JDBC applications more readable. If you have named parameter markers in an application, set the IBM® Data Server Driver for JDBC and SQLJ Connection or DataSource property enableNamedParameterMarkers to DB2BaseDataSource.YES (1) to direct the driver to accept named parameter markers and send them to the data source as standard parameter markers.

If you are connected to a DB2® for Linux, UNIX, and Windows Version 9.7 or later data server, your SQL strings can include PL/SQL blocks with named parameters. Before you can use named parameters in PL/SQL blocks, the DB2_COMPATIBILITY_VECTOR registry variable needs to be set at the data server to allow PL/SQL compilation.