Customization of IBM Data Server Driver for JDBC and SQLJ configuration properties

The IBM Data Server Driver for JDBC and SQLJ configuration properties let you set property values that have driver-wide scope. Those settings apply across applications and DataSource instances. You can change the settings without having to change application source code or DataSource characteristics.

Each IBM Data Server Driver for JDBC and SQLJ configuration property setting is of this form:
property=value

IBM Data Server Driver for JDBC and SQLJ configuration property names are case-sensitive.

You can set configuration properties in the following ways:

  • Set the configuration properties as Java system properties. Configuration property values that are set as Java system properties override configuration property values that are set in any other ways.

    For stand-alone Java applications, you can set the configuration properties as Java system properties by specifying -Dproperty=value for each configuration property when you execute the java command.

    For Java stored procedures or user-defined functions, you can set the configuration properties by specifying -Dproperty=value for each configuration property in a file whose name you specify in the JVMPROPS option. You specify the JVMPROPS options in the ENVAR option of the Language Environment® options string. The Language Environment options string is in a data set that is specified by the JAVAENV DD statement in the WLM address space startup procedure.

  • Set the configuration properties in a resource whose name you specify in the db2.jcc.propertiesFile Java system property. For example, you can specify an absolute path name for the db2.jcc.propertiesFile value.

    For stand-alone Java applications, you can set the configuration properties by specifying the -Ddb2.jcc.propertiesFile=path option when you execute the java command.

    For Java stored procedures or user-defined functions, you can set the configuration properties by specifying the -Ddb2.jcc.propertiesFile=path/properties-file-name option in a file whose name you specify in the JVMPROPS option. You specify the JVMPROPS options in the ENVAR option of the Language Environment options string. The Language Environment options string is in a data set that is specified by the JAVAENV DD statement in the WLM address space startup procedure.

  • Set the configuration properties in a resource named DB2JccConfiguration.properties. A standard Java resource search is used to find DB2JccConfiguration.properties. The IBM Data Server Driver for JDBC and SQLJ searches for this resource only if you have not set the db2.jcc.propertiesFile Java system property.

    DB2JccConfiguration.properties can be a stand-alone file, or it can be included in a JAR file. If DB2JccConfiguration.properties is a stand-alone file, the contents are automatically converted to Unicode. If you include DB2JccConfiguration.properties in a JAR file, you need to convert the contents to Unicode before you put them in the JAR file.

    If DB2JccConfiguration.properties is a stand-alone file, the path for DB2JccConfiguration.properties must be in the following places:
    • For stand-alone Java applications: Include the directory that contains DB2JccConfiguration.properties in the CLASSPATH concatenation.
    • For Java stored procedures or user-defined functions: Include the directory that contains DB2JccConfiguration.properties in the CLASSPATH concatenation in the ENVAR option of the Language Environment options string. The Language Environment options string is in a data set that is specified by the JAVAENV DD statement in the WLM address space startup procedure.

    If DB2JccConfiguration.properties is in a JAR file, the JAR file must be in the CLASSPATH concatenation.

Example: Putting DB2JccConfiguration.properties in a JAR file: Suppose that your configuration properties are in a file that is in EBCDIC code page 1047. To put the properties file into a JAR file, follow these steps:
  1. Rename DB2JccConfiguration.properties to another name, such as EBCDICVersion.properties.
  2. Run the iconv shell utility on the z/OS® UNIX System Services command line to convert the file contents to Unicode. For example, to convert EBCDICVersion.properties to a Unicode file named DB2JccConfiguration.properties, issue this command:
    iconv -f ibm-1047 -t utf-8 EBCDICVersion.properties \
      > DB2JccConfiguration.properties
    
  3. Execute the jar command to add the Unicode file to the JAR file. In the JAR file, the configuration properties file must be named DB2JccConfiguration.properties. For example:
    jar -cvf jdbcProperties.jar DB2JccConfiguration.properties