DB2 10.5 for Linux, UNIX, and Windows

Properties for the IBM Data Server Driver for JDBC and SQLJ

IBM® Data Server Driver for JDBC and SQLJ properties define how the connection to a particular data source should be made. Most properties can be set for a DataSource object or for a Connection object.

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

Methods for setting the properties

Properties can be set in one of the following ways:
  • Using setXXX methods, where XXX is the unqualified property name, with the first character capitalized.
    Properties are applicable to the following IBM Data Server Driver for JDBC and SQLJ-specific implementations that inherit from com.ibm.db2.jcc.DB2BaseDataSource:
    • com.ibm.db2.jcc.DB2SimpleDataSource
    • com.ibm.db2.jcc.DB2ConnectionPoolDataSource
    • com.ibm.db2.jcc.DB2XADataSource
  • In a java.util.Properties value in the info parameter of a DriverManager.getConnection call.
  • In a java.lang.String value in the url parameter of a DriverManager.getConnection call.

    If you specify a property name that does not exist, the IBM Data Server Driver for JDBC and SQLJ does nothing with the property setting, and does not issue an error.

    Some properties with an int data type have predefined constant field values. You must resolve constant field values to their integer values before you can use those values in the url parameter. For example, you cannot use com.ibm.db2.jcc.DB2BaseDataSource.TRACE_ALL in a url parameter. However, you can build a URL string that includes com.ibm.db2.jcc.DB2BaseDataSource.TRACE_ALL, and assign the URL string to a String variable. Then you can use the String variable in the url parameter:
        String url = 
         "jdbc:db2://sysmvs1.stl.ibm.com:5021/STLEC1" +
         ":user=dbadm;password=dbadm;" +
         "traceLevel=" +
         (com.ibm.db2.jcc.DB2BaseDataSource.TRACE_ALL) + ";";
    
         Connection con = 
           java.sql.DriverManager.getConnection(url);