Db2 Jdbc Driver Class

Db2 JDBC Driver from DbSchema About JDBC Drivers. JDBC drivers are Java library files with the extension.jar used by all Java applications to connect to the database. Usually they are provided by the same company which implemented the Db2 software. DbSchema installation kit already include an Db2 driver. Each JDBC driver is using a specific URL.

This script outputs the google search URL required for search on edocs documentation.

WebLogic Type 4 JDBC Drivers

The following sections describe how to configure and use the BEA WebLogic Type 4 JDBC driver for DB2:

The BEA WebLogic Type 4 JDBC driver for DB2 (the 'DB2 driver') supports:

  • DB2 Universal Database (UDB) 7.1, 7.2, and 8.1 on Windows NT, Windows 2000, Windows 2003, Windows XP, UNIX, Linux, and Linux/s390 via DRDA
  • DB2 6.1 and DB2 UDB 7.1 running on OS/390 and z/OS via DRDA
  • DB2 UDB V4R5, V5R1, and V5R2 running on iSeries and AS/400

Note: This documentation uses the following terms to describe the different DB2 versions:

  • 'DB2 UDB' refers to all versions of DB2 running on Windows, UNIX, and Linux/s390 platforms
  • 'DB2 OS/390' refers to all versions of DB2 on OS/390 and z/OS platforms
  • 'DB2 iSeries' refers to all versions of DB2 on iSeries and AS/400

The driver class for the BEA WebLogic Type 4 JDBC DB2 driver is:

XA: weblogic.jdbcx.db2.DB2DataSource

Non-XA: weblogic.jdbc.db2.DB2Driver

Use these driver classes when configuring a JDBC data source in your WebLogic Server domain.

To connect to a DB2 database, use the appropriate URL format:

  • DB2 on Windows NT, Windows 2000, Windows 2003, Windows XP, UNIX, Linux, and Linux/s3901:
  • DB2 on OS/390, z/OS, iSeries, and AS/4001:

Table 3-1 lists the JDBC connection properties supported by the DB2 driver, and describes each property. You can use these connection properties in a JDBC data source configuration in your WebLogic Server domain. To specify a property, use the following form in the JDBC data source configuration:

Note: All connection property names are case-insensitive. For example, Password is the same as password.

Table 3-1 DB2 Connection Properties

Property

Description

AddToCreateTable

OPTIONAL

A string that is automatically added to all Create Table statements. This field is primarily for users who need to add an 'in database' clause.

AllowImplicitResultSetCloseForXA

OPTIONAL

{true | false}. DB2 provides a mechanism that automatically closes a result set when all rows of the result set have been fetched. This mechanism increases application performance by reducing the number of database round trips. The WebLogic DB2 driver uses this mechanism by default.

Note: Problems have been noted when using this mechanism. As a workaround, you should add AllowImplicitResultSetCloseForXA=false to the properties in your data source configuration.

The default is true.

AlternateID

OPTIONAL

Sets the default DB2 schema used by unqualified SQL identifiers to the specified value. The value must be a valid DB2 schema.

BatchPerformanceWorkaround

OPTIONAL

{true | false}. For DB2 UDB 8.1, the native DB2 batch mechanism is used. This property determines whether certain restrictions are enforced to facilitate data conversions.

  • When set to false, the methods used to set the parameter values of a batch operation performed using a PreparedStatement must match the database data type of the column the parameter is associated with. This is because DB2 servers do not perform implicit data conversions.

  • When set to true, this restriction is removed; however, parameter sets may not be executed in the order they were specified.

The default is false.

See Performance Workaround for Batch Inserts and Updates for more information.

Note: For data sources used as a JMS JDBC store that use the WebLogic Type 4 JDBC driver for DB2, the BatchPerformanceWorkaround property must be set to true.

CatalogIncludesSynonyms

OPTIONAL

{true | false}. When set to true, synonyms are included in the result sets returned from the following DatabaseMetaData methods: getColumns, getProcedureColumns, and getIndexInfo. When set to false, synonyms are omitted from result sets.

The default is true.

CatalogSchema

OPTIONAL

The DB2 schema to use for catalog functions. The value must be the name of a valid DB2 schema.

The default is SYSCAT for DB2 UDB, SYSIBM for DB2 OS/390, and QSYS2 for DB2 iSeries.

To improve performance, views of system catalog tables can be created in a schema other than the default catalog schema. Setting this property to a schema that contains views of the catalog tables allows the driver to use those views. To ensure that catalog methods function correctly, views for specific catalog tables must exist in the specified schema. The views that are required depend on your DB2 database. See Using a Non-Default Schema for Catalog Methods for the required views of catalog tables.

CharsetFor65535

OPTIONAL

The code page to use to convert character data stored as bit data in character columns (Char, Varchar, Longvarchar, Char for Bit Data, Varchar for Bit Data, Longvarchar for Bit Data) defined with CCSID 65535. All character data stored as bit data retrieved from the database using columns defined with CCSID 65535 is converted using the specified code page. The value must be a string containing the name of a valid code page supported by your Java Virtual Machine, for example, CharsetFor65535=CP950. This property has no effect when writing data to character columns defined with CCSID 65535.

CodePageOverride

OPTIONAL

A code page to be used to convert Character and Clob data. The specified code page overrides the default database code page. All Character and Clob data retrieved from or written to the database is converted using the specified code page. The value must be a string containing the name of a valid code page supported by your Java Virtual Machine, for example, CodePageOverride=CP950.

CollectionId

OPTIONAL

The collection (group of packages) to which the package is bound.

This property is ignored for DB2 UDB.

The default is NULLID.

ConnectionRetryCount

OPTIONAL

The number of times the driver retries connection attempts until a successful connection is established. Valid values are 0 and any positive integer.

If set to 0, the driver does not retry connections if a successful connection is not established on the driver's first attempt to create a connection.

The default is 0.

ConnectionRetryDelay

OPTIONAL

The number of seconds the driver will wait between connection retry attempts when ConnectionRetryCount is set to a positive integer.

The default is 3.

CreateDefaultPackage

OPTIONAL

{true | false}. Determines whether the default package should be created. For DB2 OS/390 and DB2 iSeries, the package is created in the collection specified by the CollectionId property. This would be used if the package does not yet exist.

For more information about creating DB2 packages, see Creating a DB2 Package.

The default is false.

DatabaseName

The name of the database to which you want to connect (used with UDB).

DynamicSections

OPTIONAL

Specifies the number of statements that the DB2 driver package can prepare for a single user.

The default is 200.

Grantee

OPTIONAL

Specifies the name of the schema to which you want to grant EXECUTE privileges for DB2 packages. This property is ignored if the GrantExecute property is set to false.

See Creating a DB2 Package for more information about creating DB2 packages.

The default is PUBLIC.

GrantExecute

OPTIONAL

{true | false}. Determines whether EXECUTE privileges for DB2 packages are granted to a schema other than the one used to create them. If set to true, EXECUTE privileges are granted to the schema specified by the Grantee property. If set to false, EXECUTE privileges are not granted to another schema.

See Creating a DB2 Package for more information about creating DB2 packages.

The default is true.

InsensitiveResultSetBufferSize

{-1 | 0 | x}. Determines the amount of memory used by the driver to cache insensitive result set data. It must have one of the following values:

If set to -1, the driver caches all insensitive result set data in memory. If the size of the result set exceeds available memory, an OutOfMemoryException is generated. Because the need to write result set data to disk is eliminated, the driver processes the data more efficiently.

If set to 0, the driver caches all insensitive result set data in memory, up to a maximum of 2 GB. If the size of the result set data exceeds available memory, the driver pages the result set data to disk. Because result set data may be written to disk, the driver may have to reformat the data to write it correctly to disk.

If set to x, where x is a positive integer that specifies the size (in KB) of the memory buffer used to cache insensitive result set data. If the size of the result set data exceeds the buffer size, the driver pages the result set data to disk. Because the result set data may be written to disk, the driver may have to reformat the data to write it correctly to disk. Specifying a buffer size that is a power of 2 results in more efficient memory use.

The default is 2048 (KB)

LocationName

The name of the DB2 location that you want to access (used with OS/390 and iSeries).

LoginTimeout

OPTIONAL

The maximum time in seconds that attempts to create a database connection will wait. A value of 0 specifies that the timeout is the default system timeout if there is one; otherwise it specifies that there is no timeout.

PackageOwner

OPTIONAL

Specifies the owner of DB2 packages.

See Creating a DB2 Package for more information about creating DB2 packages.

The default is NULL.

Password

A case-sensitive password used to connect to your DB2 database. A password is required only if security is enabled on your database. If so, contact your system administrator to get your password.

PortNumber

OPTIONAL

The TCP port on which the database server listens for connections. The default is 50000.

ReplacePackage

OPTIONAL

{true | false}. Specifies whether the current bind process should replace an existing DB2 package. On DB2 UDB, this property must be used in conjunction with CreateDefaultPackage.

For more information about creating DB2 packages, see Creating a DB2 Package.

The default is false.

SecurityMechanism

OPTIONAL

{ClearText | EncryptedPassword | EncryptedUIDPassword}. Determines the security method the driver uses to authenticate the user to the DB2 server when establishing a connection. If the specified authentication method is not supported by the DB2 server, the connection fails and the driver generates an exception.

If set to ClearText, the driver sends the password in clear text to the DB2 server for authentication.

If set to EncryptedPassword, the driver sends an encrypted password to the DB2 server for authentication.

If set to EncryptedUIDPassword, the driver sends an encrypted user ID and password to the DB2 server for authentication.

The default is ClearText.

Requires JDK 1.4 or higher.

SendStreamAsBlob

OPTIONAL

{true | false}. Determines whether binary stream data that is less than 32K bytes is sent to the database as Long Varchar for Bit Data or Blob data. Binary stream data that is less than 32K bytes can be inserted into a Long Varchar for Bit Data column, which has a maximum length of 32K bytes, or a Blob column. Binary streams that are larger than 32K bytes can only be inserted into a Blob column. The driver always sends binary stream data larger than 32K bytes to the database as Blob data.

If set to true, the driver sends binary stream data that is less than 32K to the database as Blob data. If the target column is a Long Varchar for Bit Data column and not a Blob column, the Insert or Update statement fails. The driver automatically retries the Insert or Update statement, sending the data as Long Varchar for Bit Data, if the stream passed into the driver is resettable. Sending binary stream data that is less than 32K bytes in length initially as a Blob significantly improves performance if the Insert or Update column is a Blob column.

If set to false, the driver sends binary stream data that is less than 32K to the database as Long Varchar for Bit Data data. If the target column is a Blob column and not a Long Varchar for Bit Data column, the Insert or Update statement fails. The driver retries the Insert or Update statement, sending the data as Blob data.

The default is false.

ServerName

The name or IP address of the database server.

StripNewlines

OPTIONAL

{true | false}. Specifies whether new-line characters in a SQL statement are sent to the DB2 server. When StripNewlines=true, the DB2 driver removes all new-line characters from SQL statements.

The default is true.

UseCurrentSchema

OPTIONAL

{true | false}. Specifies whether results are restricted to the tables in the current schema if a DatabaseMetaData.getTables call is called without specifying a schema or if the schema is specified as the wildcard character %. Restricting results to the tables in the current schema improves the performance of calls for getTables methods that do not specify a schema.

If set to true, results that are returned from the getTables method are restricted to tables in the current schema. If set to false, results of the getTables method are not restricted.

The default is false.

User

The case-sensitive user name used to connect to your DB2 database.

WithHoldCursors

OPTIONAL

{true | false}. Determines whether the cursor stays open on commit—either DB2 closes all open cursors (Delete cursors) after a commit or leaves them open (Preserve cursors). If set to true, the cursor behavior is Preserve. If set to false, the cursor behavior is Delete. Rolling back a transaction closes all cursors regardless of how this property is specified.

The default is true.


When connecting to a DB2 database running on AS/400, you must set the locationName property:

  1. Obtain the 'Relational Database' value by executing the WRKRDBDIRE command on AS/400.
  2. You should see output similar to the following:

  3. In the Java client, set up the Properties object with 'user' and 'password' DB2 connection properties (see DB2 Connection Properties).
  4. In Driver.connect(), specify the following string and the Properties object as parameters:
  5. In this example, RelationalDatabaseName is the value of Database obtained from the result of running the WRKRDBDIRE command.

The following is an excerpt of the Java client :

A DB2 package is a control structure on the DB2 server produced during program preparation that is used to execute SQL statements. The DB2 driver automatically creates all DB2 packages required at connection time. If a package already exists, the driver uses the existing package to establish a connection.

Note: The initial connection may take a few minutes because of the number and size of the packages that must be created for the connection. Subsequent connections do not incur this delay.

By default, DB2 packages created by the DB2 driver contain 200 dynamic sections and are created in the NULLID collection (or library). In most cases, you do not need to create DB2 packages because the DB2 driver automatically creates them at connection time. If required, you can create DB2 packages in either of the following ways:

  • Manually force the DB2 driver to create a package using the WebLogic Server dbping utility. See Creating a DB2 Package Using dbping.
  • Automatically create a package by setting specific connection properties in the connection URL. See Creating a DB2 Package Using Connection Properties.

Note: Your user ID must have CREATE PACKAGE privileges on the database, or your database administrator must create packages for you.

Your user ID (the user ID listed in the JDBC data source configuration) must be the owner of the package.

The user ID creating the DB2 packages must have BINDADD privileges on the database. Consult with your database administrator to ensure that you have the correct privileges.

Creating a DB2 Package Using dbping

To create a package on the DB2 server with the WebLogic Type 4 JDBC DB2 driver, you can use the WebLogic Server dbping utility. The dbping utility is used to test the connection between your client machine and a DBMS via a JDBC driver. Because the WebLogic Type 4 JDBC DB2 driver automatically creates a DB2 package if one does not already exist, running this utility creates a default DB2 package on the DB2 server.

For details about using the dbping utility to create a DB2 package, see Creating a DB2 Package with dbping.

Creating a DB2 Package Using Connection Properties

You can create a DB2 package automatically by specifying specific connection properties in the initial connection URL. Table 3-2 lists the connection properties you should use in your initial connection URL when you create a DB2 package:

Note: This method is not recommended for use with WebLogic Server JDBC data sources because every connection in the data source uses the same URL and connection properties. When a JDBC data source with multiple connections is created, the package would be recreated when each database connection is created.

Table 3-2 Connection Properties for an Initial Connection URL When Creating DB2 Packages

Property

Database

CollectionId=collection_name
(where collection_name is the name of the collection or library to which DB2 packages are bound)

DB2 OS/390 and iSeries

CreateDefaultPackage=true

DB2 UDB, OS/390, and iSeries

ReplacePackage=true

DB2 UDB

DynamicSections=x
(where x is a positive integer)

DB2 UDB, OS/390, and iSeries


Using CreateDefaultPackage=TRUE creates a package with a default name. If you use CreateDefaultPackage=TRUE, and you do not specify a CollectionId, the NULLID CollectionId is created.

Note: On DB2 UDB, you must use ReplacePackage=TRUE in conjunction with CreateDefaultPackage to create a new package; however, if a package already exists, it will be replaced when using ReplacePackage=TRUE.

Example for DB2 UDB:

The following URL creates DB2 packages with 400 dynamic sections. If any DB2 packages already exist, they will be replaced by the new ones being created.

Example for DB2 OS/390 and iSeries:

The following URL creates DB2 packages with 400 dynamic sections.

Notes About Increasing Dynamic Sections in the DB2 Package

A dynamic section is the actual executable object that contains the logic needed to satisfy a dynamic SQL request. These sections are used for handles and prepared statements and the associated result sets.

In some cases, you may need to create DB2 packages with more than the default number of dynamic sections (200). Consider the following information if your application requires DB2 packages with a large number of dynamic sections:

  • Creating DB2 packages with a large number of dynamic sections may exhaust certain server resources. In particular, you may need to increase the database parameter PCKCACHE_SZ to allow the larger packages to be created.
  • The creation of more dynamic sections will slow down the initial creation of the DB2 package.
  • Using DB2 packages with a large number of dynamic sections may impact application performance. If a small number of sections are in use at one time, there will be no impact on the application. If a large number of sections are in use at one time, the performance of the application may decrease because the database will expend resources to check all open sections for locks.
  • As the number of open sections increases, so does the likelihood that a deadlock situation may occur.
  • If your application is mostly executing select statements, it is best to operate in the default mode of automatically committing the database. Dynamic sections are not freed in the DB2 package until the database is committed even if the statements are closed in the application. In this mode the database will commit every time a SQL statement is executed and free all of the sections that were opened. If you need to operate in a manual commit mode, then it is advisable to commit the database as often as possible to ensure that all server resources are freed in a timely manner.
  • Statements cached in the WebLogic Server prepared statement cache will keep sections in use so that the prepared statements can be reused.
  • The DB2 server has a limit on dynamic sections. It is possible to try to create more sections than the server will allow you to create.

Table 3-3 lists the data types supported by the DB2 driver and how they are mapped to JDBC data types.

Table 3-3 DB2 Data Types

DB2 Data Type

JDBC Data Type

Bigint1

BIGINT

Blob2

BLOB

Char

CHAR

Char for Bit Data

BINARY

Clob

CLOB

Date

DATE

DBClob3

CLOB

Decimal

DECIMAL

Double

DOUBLE

Float

FLOAT

Integer

INTEGER

Long Varchar

LONGVARCHAR

Long Varchar for Bit Data

LONGVARBINARY

Numeric

NUMERIC

Real

REAL

Rowid4

VARBINARY

Smallint

SMALLINT

Time

TIME

Timestamp

TIMESTAMP

Varchar

VARCHAR

Varchar for Bit Data

VARBINARY


1. Bigint data type is supported only for DB2 UDB 8.1.
2. Blob data type is supported only for DB2 UDB 8.1, DB2 OS/390, and DB2 iSeries V5R2 (see Large Object (LOB) Support).
3. DBClob data type is supported only for DB2 UDB 8.1, DB2 7.x OS/390, and DB2 iSeries V5R2 (see Large Object (LOB) Support).
4. Rowid data type is supported only for DB2 OS/390 and DB2 iSeries V5R2.

See GetTypeInfo for more information about data types.

To improve performance, views of system catalog tables can be created in a schema other than the default catalog schema. Setting the CatalogSchema property to a DB2 schema that contains views of catalog tables allows the driver to use those views. To ensure that catalog methods function correctly, views for the catalog tables listed in Table 3-4 must exist in the specified schema. The views that are required depend on your DB2 database.

Table 3-4 Catalog Tables for DB2

Database

Catalog Tables

DB2 UDB

SYSCAT.TABLES
SYSCAT.COLUMNS
SYSCAT.PROCEDURES
SYSCAT.PROCPARAMS
SYSCAT.COLAUTH
SYSCAT.TABAUTH
SYSCAT.KEYCOLUSE
SYSCAT.INDEXES
SYSCAT.INDEXCOLUSE
SYSCAT.REFERENCES
SYSCAT.SYSSCHEMATA
SYSCAT.TYPEMAPPINGS
SYSCAT.DBAUTH

DB2 OS/390

SYSIBM.SYSTABCONST
SYSIBM.SYSTABLES
SYSIBM.SYSSYNONYMS
SYSIBM.SYSCOLUMNS
SYSIBM.SYSPROCEDURES
SYSIBM.SYSROUTINES
SYSIBM.SYSPARMS
SYSIBM.SYSCOLAUTH
SYSIBM.SYSTABAUTH
SYSIBM.SYSKEYS
SYSIBM.SYSINDEXES
SYSIBM.SYSRELS
SYSIBM.SYSFOREIGNKEYS
SYSIBM.SYSSCHEMAAUTH
SYSIBM.SYSDBAUTH

DB2 iSeries

QSYS2.SYSCST
QSYS2.SYSKEYCST
QSYS2.SYSPROCS
QSYS2.SYSPARMS
QSYS2.SYSTABLES
QSYS2.SYSSYNONYMS
QSYS2.SYSCOLUMNS
QSYS2.SQLTABLEPRIVILEGES
QSYS2.SYSKEYS
QSYS2.SYSINDEXES
QSYS2.SYSREFCST


See SQL Escape Sequences for JDBC for information about SQL escape sequences supported by the DB2 driver.

The DB2 driver supports the isolation levels listed in Table 3-5. JDBC isolation levels are mapped to the appropriate DB2 transaction isolation levels as shown. The default isolation level is Read Committed.

Table 3-5 Supported Isolation Levels

JDBC Isolation Level

DB2 Isolation Level

None

No Commit1

Read Committed

Cursor Stability

Read Uncommitted

Uncommitted Read

Repeatable Read

Read Stability

Serializable

Repeatable Read


1. Supported for DB2 iSeries versions that do not enable journaling.

The DB2 driver supports scroll-insensitive result sets and updatable result sets.

Note: When the DB2 driver cannot support the requested result set type or concurrency, it automatically downgrades the cursor and generates one or more SQLWarnings with detailed information.

To use JDBC distributed transactions through JTA with the DB2 driver, DB2 UDB 8.1 is required.

Retrieving and updating Blobs is supported by the DB2 driver only with DB2 UDB 8.1, DB2 OS/390, and DB2 iSeries V5R2.

Retrieving and updating Clobs is supported by the DB2 driver. The DB2 driver supports Clobs up to a maximum of 2 GB with DB2 UDB 8.1, DB2 OS/390, and DB2 iSeries V5R2; it supports Clobs up to a maximum of 32 KB with all other supported DB2 database versions.

Retrieving and updating DBClobs is supported by the DB2 driver only with DB2 UDB 8.1, DB2 OS/390 7.x, and DB2 iSeries V5R2.

For DB2 UDB 8.1 and DB2 OS/390, the DB2 driver uses the native DB2 batch mechanism. By default, the methods used to set the parameter values of a batch performed using a PreparedStatement must match the database data type of the column with which the parameter is associated.

DB2 servers do not perform any implicit data conversions, so specifying parameter values that do not match the column data type causes the DB2 server to generate an error. For example, to set the value of a Blob parameter using a stream or byte array when the length of the stream or array is less than 32K, you must use the setObject method and specify the target JDBC type as BLOB; you cannot use setBinaryStream or setBytes methods.

To remove the method-type restriction, set the BatchPeformanceWorkaround connection property to true (see DB2 Connection Properties). For example, you can use the setBinaryStream or setBytes methods to set the value of a Blob parameter regardless of the length of the stream or array; however, the parameter sets may not be executed in the order they were specified.

Notes: When you create a data source in the Administration Console, the Administration Console sets the BatchPeformanceWorkaround connection property to true by default.

For data sources used as a JMS JDBC store that use the WebLogic Type 4 JDBC driver for DB2, the BatchPerformanceWorkaround property must be set to true.

The DB2 driver supports returning parameter metadata for all statements with DB2 UDB 8.1, DB2 OS/390, and DB2 iSeries V5R2.

For all other supported DB2 database versions, the DB2 driver supports returning parameter metadata for the following forms of SQL:

  • INSERT INTO foo VALUES (?, ?, ?)
  • INSERT INTO foo (col1, col2, col3) VALUES (?, ?, ?)
  • UPDATE foo SET col1=?, col2=?, col3=? WHERE col1 operator ? [{AND | OR} col2 operator ?]

where operator is any of the following SQL operators: =, <, >, <=, >=, and <>.

The DB2 driver supports retrieving the values of auto-generated keys. An auto-generated key returned by the DB2 driver is the value of an auto-increment column.

How you return those values depends on whether you are using an Insert statement that contains parameters:

  • When using an Insert statement that does not contain any parameters, the DB2 driver supports the following form of the Statement.execute and Statement.executeUpdate methods to inform the driver to return the values of auto-generated keys:
    • Statement.execute (String sql, int autoGeneratedKeys)
    • Statement.executeUpdate (String sql, int autoGeneratedKeys)
  • When using an Insert statement that contains parameters, the DB2 driver supports the following form of the Connection.prepareStatement method to inform the driver to return the values of auto-generated keys:
    • Connection.prepareStatement (String sql, int autoGeneratedKeys)

The application fetches the values of generated keys from the driver using the Statement.getGeneratedKeys method.

Due to a defect in DB2 servers, problems may occur when using a driver patch that is equal to, or greater than the patch levels above, if connecting to DB2 UDB on UNIX, Windows, or Linux where the server version is earlier than DB2 v8 FixPak 11. If you have connecton problems, you may need to include the following driver property in your configuration:

Use the following table to provide guidance on when to use ServerReleaseLevel:

Table 3-6 Usage Guidelines for ServerReleaseLevel=SQL08020

Server Version

Driver Version

Pre 3.4.72

3.4.72 or higher

Pre 3.5.14

3.5.14 or higher

Pre-DB2 v8 FP11

Unavailable/Not required

May need to be used

Unavailable/Not required

May need to be used

DB2 v8 FP11 or higher

Unavailable/Not required

Do not use

Unavailable/Not required

Do not use


For more information, see IBM's support and download site at DB2 UDB Version 8.1 FixPak 11 (also known as Version 8.2 FixPak 4).


The script content on this page is for navigation purposes only and does not alter the content in any way.

The following sections describe how to configure and use the Oracle Type 4 JDBC driver for DB2:

DB2 Driver Classes

The driver classes for the Oracle Type 4 JDBC DB2 driver are as follows:

Use these driver classes when configuring a JDBC data source in your WebLogic Server domain.

J2EE Connector Architecture Resource Adapter Class

The ManagedConnectionFactory class for the Informix resource adapter is:

com.weblogic.resource.spi.InformixManagedConnectionFactory

DB2 URL

The connection URL format for the DB2 driver is:

where:

  • hostname is the IP address or TCP/IP host name of the server to which you are connecting. See Using IP Addresses for details on using IP addresses.

    Note:

    Untrusted applets cannot open a socket to a machine other than the originating host.
  • port is the number of the TCP/IP port.

  • property=value specifies connection properties. For a list of connection properties and their valid values, see DB2 Connection Properties.

For example:

DB2 UDB for Linux, UNIX, and Windows

DB2 UDB for z/OS and iSeries

DB2 Connection Properties

Table 3-1 lists the JDBC connection properties supported by the DB2 driver, and describes each property. You can use these connection properties in a JDBC data source configuration in your WebLogic Server domain.

Note:

All connection property names are case-insensitive. For example, Password is the same as password. Required properties are noted as such. The data type listed for each connection property is the Java data type used for the property value in a JDBC data source.

To specify a property, use the following form in the JDBC data source configuration: property=value.

Table 3-1 DB2 Connection Properties

PropertyDescription

AccountingInfo

Accounting information to be stored in the database. This value sets the CURRENT CLIENT_ACCTNG register (DB2 for Linux/UNIX/Windows) or the CLIENT ACCTNG register (DB2 for z/OS and DB2 for iSeries) in the database.This value is for database administration/monitoring purposes

Data Type: String

Valid Values: string where string is the accounting information. The default value is an empty string.

AddToCreateTable

A string that is appended to the end of all CREATE statements. This field is primarily for users who need to add an 'in database' clause.

Data Type: String

Valid Values: string where string is the set of characters appended to all CREATE statements.

AllowImplicitResultSetCloseForXA

True or false. DB2 provides a mechanism that automatically closes a result set when all rows of the result set have been fetched. This mechanism increases application performance by reducing the number of database round trips. The WebLogic DB2 driver uses this mechanism by default.

Note: Problems have been noted when using this mechanism. As a workaround, you should add AllowImplicitResultSetCloseForXA=false to the properties in your data source configuration.

The default is true.

AlternateID

Sets the default DB2 schema used by unqualified SQL identifiers to the specified value.

For DB2 for Linux/UNIX/Windows and DB2 for iSeries, this property sets the value in the DB2 CURRENT SCHEMA special register.

For DB2 for z/OS, this property sets the value in the DB2 CURRENT SQLID special register.

Valid Values:

  • For DB2 for Linux/UNIX/Windows and DB2 for iSeries, a valid DB2 schema name. This value is not validated by the database server.

  • For DB2 for z/OS, this value is validated by the database server. Refer to your IBM documentation for valid values for the CURRENT SQLID register.

AlternateServers

A list of alternate database servers that is used to failover new or lost connections, depending on the failover method selected. See the FailoverMode property for information about choosing a failover method.

Data type: String

Valid Values:

(servername1[:port1][;property=value[;...]

,servername2[:port2][;property=value[;...]]]...]

The server name (servername1, servername2, and so on) is required for each alternate server entry. Port number (port1, port2, and so on) and connection properties (property=value) are optional for each alternate server entry. If the port is unspecified, the port number of the primary server is used. If the port number of the primary server is unspecified, the default port number of 2003 is used. Optional connection properties are DatabaseName and InformixServer.

Example: The following URL contains alternate server entries for server2 and server3. The alternate server entries contain the optional DatabaseName property.

jdbc:weblogic:db2://server1:50000;DatabaseName=TEST; User=test;Password=secret;AlternateServers=(server2:50000; DatabaseName=TEST2,server3:50000;DatabaseName=TEST3)

Default: None

ApplicationName

The name of the application to be stored in the database. This value sets the CURRENT CLIENT_APPLNAME register (DB2 for Linux/UNIX/Windows) or CLIENT APPLNAME register (DB2 for z/OS and DB2 for iSeries) in the database. For DB2 V9.1 and higher for Linux/UNIX/Windows, this value also sets the APPL_NAME value of the SYSIBMADM.APPLICATIONS table. These values are used for database administration/monitoring purposes.

Valid Values: string where string is the name of the application. Your database may impose character length restrictions on the value. If the value exceeds a restriction, the driver truncates it.

Data Type: String

Default is empty string.

AuthenticationMethod

Determines which authentication method the driver uses when establishing a connection.

Valid Values: Kerberos, encryptedUIDPassword, encryptedPassword, clearText , or client.

If kerberos, the driver uses Kerberos authentication. The driver ignores any user ID or password specified.

If encryptedUIDPassword, the driver uses user ID/password authentication. The driver sends an encrypted user ID and password to the DB2 server for authentication. If a user ID and password are not specified, the driver throws an exception. If this value is set, the driver can also use data encryption (see the EncryptionMethod property for details).

If encryptedPassword, the driver uses user ID/password authentication. The driver sends a user ID in clear text and an encrypted password to the DB2 server for authentication. If a user ID and password are not specified, the driver throws an exception. If this value is set, the driver can also use data encryption (see the EncryptionMethod property for details).

If set to clearText (the default), the driver uses user ID/password authentication. The driver sends the user ID and password in clear text to the DB2 server for authentication. If a user ID and password are not specified, the driver throws an exception. If this value is set, the driver can also use data encryption (see the EncryptionMethod property for details).

If client, the driver uses client authentication. The DB2 server relies on the client to authenticate the user and does not provide additional authentication. The driver ignores any user ID or password specified.

The User property provides the user ID. The Password property provides the password.

If the specified authentication method is not supported by the DB2 server, the connection fails and the driver throws an exception.

The default is clearText.

See Authentication for more information about using authentication with the DB2 driver.

BatchPerformanceWorkaround

The DB2 driver uses the native DB2 batch mechanism. This property determines whether certain restrictions are enforced to facilitate data conversions.

Valid Values: true | false

  • When set to false, the methods used to set the parameter values of a batch operation performed using a PreparedStatement must match the database data type of the column the parameter is associated with. This is because DB2 servers do not perform implicit data conversions.

  • When set to true, restrictions are removed; however, parameter sets may not be executed in the order they were specified.

The default is false.

See Batch Inserts and Updates for more information.

Note: For data sources used as a JMS JDBC store that use the Oracle Type 4 JDBC driver for DB2, the BatchPerformanceWorkaround property must be set to true.

BulkLoadBatchSize

Provides a suggestion to the driver for the number of rows to load to the database at a time when bulk loading data. Performance can be improved by increasing the number of rows the driver loads at a time because fewer network round trips are required. Be aware that increasing the number of rows that are loaded also causes the driver to consume more memory on the client.

NOTES:

  • This property suggests the number of rows regardless of which bulk load method is used: using a DDBulkLoad object or using bulk load for batch inserts.

  • The DDBulkObject.setBatchSize() method overrides the value set by this property.

Valid Values: x where x is a positive integer. The default is 2048.

Data Type: long

CatalogIncludesSynonyms

Determines whether synonyms are included in the result sets returned from the DatabaseMetaData.getColumns() method.

Data Type: True or false.

If set to true (the default), synonyms are included in the result sets returned from the DatabaseMetaData.getColumns() method.

If set to false, synonyms are omitted from result sets returned from the DatabaseMetaData.getColumns() method.

See Performance Considerations for information about configuring this property for optimal performance.

The default is true.

CatalogOptions

Determines which type of metadata information is included in result sets when an application calls DatabaseMetaData methods.

Valid Values: 0 | 2 | 6 and the default value is 2.

Data Type: int

If 0, result sets do not contain synonyms.

If 2, result sets contain synonyms that are returned from the following DatabaseMetaData methods: getColumns(), getExportedKeys(), getFunctionColumns(), getFunctions(), getImportedKeys(), getIndexInfo(), getPrimaryKeys(), getProcedureColumns(), and getProcedures().

If 6, a hint is provided to the driver to emulate getColumns() calls using the ResultSetMetaData object instead of querying database catalogs for column information. Result sets contain synonyms. Using emulation can improve performance because the SQL statement that is formulated by the emulation is less complex than the SQL statement that is formulated using getColumns(). The argument to getColumns() must evaluate to a single table. If it does not, because of a wildcard or null value, for example, the driver reverts to the default behavior for getColumns() calls.

CatalogSchema

The DB2 schema to use for catalog functions. The value must be the name of a valid DB2 schema. The default depends on the platform of the DB2 database.

Valid Values: string where string is the name of a valid DB2 schema. The default is SYSCAT (DB2 for Linux/UNIX/Windows); SYSIBM (DB2 for z/OS); or QSYS2 (DB2 for iSeries).

Data Type: String

To improve performance, views of system catalog tables can be created in a schema other than the default catalog schema. Setting this property to a schema that contains views of the catalog tables allows the driver to use those views. To ensure that catalog methods function correctly, views for specific catalog tables must exist in the specified schema. The views that are required depend on your DB2 database. See Non-Default Schemas for Catalog Methods for the required views of catalog tables.

See Performance Considerations for information about configuring this property for optimal performance.

CharsetFor65535

The code page to use to convert character data stored as bit data in character columns (Char, Varchar, Longvarchar, Char for Bit Data, Varchar for Bit Data, Longvarchar for Bit Data) defined with CCSID 65535. All character data stored as bit data retrieved from the database using columns defined with CCSID 65535 is converted using the specified code page. The value must be a string containing the name of a valid code page supported by your JVM, for example, CharsetFor65535=CP950. This property has no effect when writing data to character columns defined with CCSID 65535.

ClientHostName

The host name of the client machine to be stored in the database. This value sets the CURRENT CLIENT_WRKSTNNAME register (DB2 for Linux/UNIX/Windows) or CLIENT WRKSTNNAME register (DB2 for z/OS and DB2 for iSeries) in the database. This value is used for database administration/monitoring purposes.

Valid Values: string where string is the host name of the client machine. Your database may impose character length restrictions on the value that is set by this property. If the value exceeds a restriction, the driver truncates it. Default is empty string.

Data Type: String

ClientUser

The user ID to be stored in the database. This property sets the CURRENT CLIENT_USERID register (DB2 for Linux/UNIX/Windows) and CLIENT USERID register (DB2 for z/OS and DB2 for iSeries) in the database. This value is used for database administration/monitoring purposes.

Valid Values: string where string is a valid user ID. Your database may impose character length restrictions on the value that is set by this property. If the value exceeds a restriction, the driver truncates it. Default is empty string.

Data Type: String

CodePageOverride

A code page to be used to convert Character and Clob data. The specified code page overrides the default database code page or column collation. All Character and Clob data retrieved from or written to the database is converted using the specified code page. The value must be a string containing the name of a valid code page supported by your JVM, for example, CodePageOverride=CP950.

Data Type: String

By default, the driver automatically determines which code page to use to convert Character data. Use this property only if you need to change the driver's default behavior.

CollectionId (DEPRECATED)

This property is recognized for backward compatibility, but we recommend that you use the PackageCollection property instead to specify the name of the collection or library (group of packages) to which DB2 packages are bound.

ConnectionRetryCount

The number of times the driver retries connection attempts until a successful connection is established.

Valid Values: 0 | x where x is any postive integer.

Data Type: int

If 0, the driver does not retry connections if a successful connection is not established on the driver's first attempt to create a connection.

If set to x, the driver retries connection attempts the specified number of times. If a connection is not established during the retry attempts, the driver returns an exception that is generated by the last database server to which it tried to connect.

The ConnectionRetryDelay property specifies the wait interval, in seconds, used between retry attempts.

The default is 5.

ConnectionRetryDelay

The number of seconds the driver waits between connection retry attempts when ConnectionRetryCount is set to a positive integer.

Valid Values: 0 | x where x is a number of seconds.

If 0, the driver does not delay between retries.

If x, the driver waits between connection retry attempts the specified number of seconds.

The default is 1.

ConvertNull

Controls how data conversions are handled for null values.

Valid Values: 0 | 1

Data Type: int

If 0, the driver does not perform the data type check if the value of the column is null. This allows null values to be returned even though a conversion between the requested type and the column type is undefined.

If 1 (the default), the driver checks the data type being requested against the data type of the table column storing the data. If a conversion between the requested type and column type is not defined, the driver generates an 'unsupported data conversion' exception regardless of the data type of the column value.

CreateDefaultPackage

Determines whether the driver automatically creates required DB2 packages.

Valid Values: true | false

If true, the DB2 driver automatically creates required DB2 packages, even if they already exist. Existing DB2 packages are replaced by the new packages.

If false (the default), the driver determines if the required DB2 packages exist. If they do not, the driver automatically creates them.

For DB2 for Linux/UNIX/Windows, this property must be used in conjunction with the ReplacePackage property.

For DB2 for z/OS and DB2 for iSeries, DB2 packages are created in the collection or library specified by the PackageCollection property.

For more information about creating DB2 packages, see Creating a DB2 Package.

CurrentFunctionPath

A list of DB2 schema names that are used to resolve unqualified function names and data type references in dynamically prepared SQL statements. It also is used to resolve unqualified stored procedure names that are specified in CALL statements. This property sets the CURRENT PATH register in the database.

Valid Values: schema_name[[,schema_name]...] where schema_name is a valid DB2 schema name.

Data Type: String

Default is null.

Database

An alias for the DatabaseName property.

DatabaseName (REQUIRED)

The name of the database to which you want to connect. This property is supported only for DB2 for Linux/UNIX/Windows.

Note: This property is an alias for LocationName when connecting to DB2 for z/OS or iSeries.

Valid Values: string where string is the name of a DB2 database. Default is None.

Data Type: StringAlias: Database property. If both the Database and DatabaseName properties are specified in a connection URL, the last property that is positioned in the connection URL is used. For example, if your application specifies the following connection URL, the value of the Database connection property would be used instead of the value of the DatabaseName connection property.

jdbc:weblogic:db2://server1:50000;DatabaseName=jdbc; Database=acct;User=test;Password=secret

See also Database Connection Property.

DynamicSections

The maximum number of prepared statements that the DB2 driver can have open at any time. The value must be a positive integer.

The default is 200.

EnableBulkLoad

Specifies whether the driver uses the native bulk load protocols in the database instead of the batch mechanism for batch inserts. Bulk load bypasses the data parsing that is usually done by the database, providing an additional performance gain over batch operations. This property allows existing applications with batch inserts to take advantage of bulk load without requiring changes to the application code.

Valid Values: true | false

If true, the driver uses the native bulk load protocols for batch inserts. Any value set for BatchPerformanceWorkaround is ignored.

If false, the driver uses the batch mechanism for batch inserts.

Data Type: boolean

Default is false.

EnableCancelTimeout

Determines whether a cancel request sent by the driver as the result of a query timing out is subject to the same query timeout value as the statement it cancels.

Valid Values: true | false

Data Type: boolean

If true, the cancel request times out using the same timeout value, in seconds, that is set for the statement it cancels. For example, if your application calls Statement.setQueryTimeout(5) on a statement and that statement is cancelled because its timeout value was exceeded, the driver sends a cancel request that also will time out if its execution exceeds 5 seconds. If the cancel request times out, because the server is down, for example, the driver throws an exception indicating that the cancel request was timed out and the connection is no longer valid.

If false (the default), the cancel request does not time out.

EncryptionMethod

Determines whether data is encrypted and decrypted when transmitted over the network between the driver and database server.

NOTE: Connection hangs can occur when the driver is configured for SSL and the database server does not support SSL. You may want to set a login timeout using the LoginTimeout property to avoid problems when connecting to a server that does not support SSL.

Valid Values: noEncryption | DBEncryption | requestDBEncryption| SSL

If noEncryption, data is not encrypted or decrypted.

If DBEncryption, data is encrypted using DES encryption if the database server supports it. If the database server does not support DES encryption, the connection fails and the driver throws an exception. The AuthenticationMethod property must be set to a value of clearText, encryptedPassword, or encryptedUIDPassword. This value is not supported for DB2 for iSeries.

If requestDBEncryption, data is encrypted using DES encryption if the database server supports it. If the database server does not support DES encryption, the driver attempts to establish an unencrypted connection. The AuthenticationMethod property must be set to a value of clearText, encryptedPassword, or encryptedUIDPassword. This value is not supported for DB2 for iSeries.

If SSL, data is encrypted using SSL. If the database server does not support SSL, the connection fails and the driver throws an exception. When SSL is enabled, the following properties also apply:

  • HostNameInCertificate

  • KeyStore (for SSL client authentication)

  • KeyStore (for SSL client authentication)

  • KeyStorePassword (for SSL client authentication)

  • KeyPassword (for SSL client authentication)

  • TrustStore

  • TrustStorePassword

  • ValidateServerCertificate

Data Type: String

The default is noEncryption.

FailoverGranularity

Determines whether the driver fails the entire failover process or continues with the process if exceptions occur while trying to reestablish a lost connection. This property is ignored if FailoverMode=connect.

Valid Values: nonAtomic | atomic | atomicWithRepositioning | disableIntegrityCheck

If nonAtomic, the driver continues with the failover process and posts any exceptions on the statement on which they occur.

If atomic, the driver fails the entire failover process if an exception is generated as the result of restoring the state of the connection. If an exception is generated as a result of restoring the state of work in progress, the driver continues with the failover process, but generates an exception warning that the Select statement must be reissued.

If atomicWithRepositioning, the driver fails the entire failover process if any exception is generated as the result of restoring the state of the connection or the state of work in progress.

If disableIntegrityCheck, the driver does not verify that the rows restored during the failover process match the original rows. This value is applicable only when FailoverMode=select.

Data Type: String

Default is nonAtomic.

FailoverMode

Specifies the type of failover method the driver uses.

Valid Values: connect | extended| select

If connect, the driver provides failover protection for new connections only.

If extended, the driver provides failover protection for new and lost connections, but not any work in progress.

If select, the driver provides failover protection for new and lost connections. In addition, it preserves the state of work performed by the last Select statement executed on the Statement object.

NOTES:

  • The AlternateServers property specifies one or multiple alternate servers for failover and is required for all failover methods.

  • The FailoverGranularity property determines which action the driver takes if exceptions occur during the failover process.

  • The FailoverPreconnect property specifies whether the driver tries to connect to multiple database servers (primary and alternate) at the same time.

Data Type: String

Default is connect.

FailoverPreconnect

Specifies whether the driver tries to connect to the primary and an alternate server at the same time. This property is ignored if FailoverMode=connect.

Valid Values: true | false

If true, the driver tries to connect to the primary and an alternate server at the same time. This can be useful if your application is time-sensitive and cannot absorb the wait for the failover connection to succeed.

If false, the driver tries to connect to an alternate server only when failover is caused by an unsuccessful connection attempt or a lost connection. This value provides the best performance, but your application typically experiences a short wait while the failover connection is attempted.

NOTE: The AlternateServers property specifies one or multiple alternate servers for failover.

Data Type: boolean

Default is false.

Grantee

The name of the schema to which you want to grant EXECUTE privileges for DB2 packages. This property is ignored if the GrantExecute property is set to false.

Valid Values: string where string is a valid DB2 schema.

Data Type: String

IMPORTANT: Using a value other than PUBLIC restricts access to use the driver. For example, if you set this property to TSMITH, only the user TSMITH would be allowed access to use the driver against the server.

Default is PUBLIC.

GrantExecute

Determines which DB2 schema is granted EXECUTE privileges for DB2 packages.

Valid Values: true | false

Data Type: boolean

If true, EXECUTE privileges are granted to the schema that is specified by the Grantee property.

If false, EXECUTE privileges are granted to the schema that created the DB2 packages.

The default is true.

HostNameInCertificate

Specifies a host name for certificate validation when SSL encryption is enabled (EncryptionMethod=SSL) and validation is enabled (ValidateServerCertificate=true). This property is optional and provides additional security against man-in-the-middle (MITM) attacks by ensuring that the server the driver is connecting to is the server that was requested.

NOTES:

  • If SSL encryption or certificate validation is not enabled, this property is ignored.

  • If SSL encryption and validation is enabled and this property is unspecified, the driver uses the server name specified in the connection URL or data source of the connection to validate the certificate.

Valid Values: host_name | #SERVERNAME# where host_name is a valid host name.

If host_name, the driver compares the specified host name to the DNSName value of the SubjectAlternativeName in the certificate. If a DNSName value does not exist in the SubjectAlternativeName or if the certificate does not have a SubjectAlternativeName, the driver compares the host name with the Common Name (CN) part of the certificate's Subject name. If the values do not match, the connection fails and the driver throws an exception.

If #SERVERNAME# is specified, the driver compares the server name that is specified in the connection URL or data source of the connection to the DNSName value of the SubjectAlternativeName in the certificate. If a DNSName value does not exist in the SubjectAlternativeName or if the certificate does not have a SubjectAlternativeName, the driver compares the host name to the CN part of the certificate's Subject name. If the values do not match, the connection fails and the driver throws an exception. If multiple CN parts are present, the driver validates the host name against each CN part. If any one validation succeeds, a connection is established.

Data Type: String

Default is empty string.

ImportStatementPool

Specifies the path and file name of the file to be used to load the contents of the statement pool. When this property is specified, statements are imported into the statement pool from the specified file. If the driver cannot locate the specified file when establishing the connection, the connection fails and the driver throws an exception.

Valid Values: string where string is the path and file name of the file to be used to load the contents of the statement pool.

Data Type: String

Default is empty string.

InitializationString

Specifies one or multiple SQL commands to be executed by the driver after it has established the connection to the database and has performed all initialization for the connection. If the execution of a SQL command fails, the connection attempt also fails and the driver throws an exception indicating which SQL command or commands failed.

Valid Values: command[[;command]...] where command is a SQL command.

NOTE: Multiple commands must be separated by semicolons. In addition, if this property is specified in a connection URL, the entire value must be enclosed in parentheses when multiple commands are specified.

Example: The following connection URL adds USER2 to the CURRENT PATH special register and sets the CURRENT PRECISION special register to DEC31.

jdbc:datadirect:db2://server1:50000; InitializationString=(SET CURRENT PATH=current_path, USER2;SET CURRENT PRECISION='DEC31')

NOTE: Setting the CURRENT PRECISION special register is only valid for DB2 for z/OS.

Data Type: String

InsensitiveResultSetBufferSize

Determines the amount of memory used by the driver to cache insensitive result set data.

Valid Values -1 | 0 | x

Data Type: int

If -1, the driver caches all insensitive result set data in memory. If the size of the result set exceeds available memory, an OutOfMemoryException is generated. Because the need to write result set data to disk is eliminated, the driver processes the data more efficiently.

If 0, the driver caches all insensitive result set data in memory, up to a maximum of 2 GB. If the size of the result set data exceeds available memory, the driver pages the result set data to disk. Because result set data may be written to disk, the driver may have to reformat the data to write it correctly to disk.

If x, where x is a positive integer that specifies the size (in KB) of the memory buffer used to cache insensitive result set data. If the size of the result set data exceeds the buffer size, the driver pages the result set data to disk. Because the result set data may be written to disk, the driver may have to reformat the data to write it correctly to disk. Specifying a buffer size that is a power of 2 results in more efficient memory use.

The default is 2048 (KB)

JavaDoubleToString

Determines whether the driver uses its internal conversion algorithm or the JVM conversion algorithm when converting double or float values to string values.

Valid Values: true | false

If true, the driver uses the JVM algorithm when converting double or float values to string values.

If false, the driver uses its internal algorithm when converting double or float values to string values. Using this value improves performance; however, slight rounding differences can occur when compared to the same conversion using the JVM algorithm. These differences are within the allowable error of the double and float data types.

The default is false.

JDBCBehavior

Determines how the driver describes database data types that map to the following JDBC 4.0 data types: NCHAR, NVARCHAR, NLONGVARCHAR, NCLOB, and SQLXML. This property is applicable only when the application is using Java SE 6.

Valid Values 0 | 1

Data Type: int

If 0, the driver describes the data types as JDBC 4.0 data types when using Java SE 6.

If 1, the driver describes the data types using JDBC 3.0-equivalent data types, regardless of JVM. This allows your application to continue using JDBC 3.0 types in a Java SE 6 environment. In addition, the JDBC 4.0 method ResultSet.getHoldability() returns the value of the JDBC 3.0 method Connection.getHoldability().

Default is 1.

KeyPassword

Specifies the password that is used to access the individual keys in the keystore file when SSL is enabled (EncryptionMethod=SSL) and SSL client authentication is enabled on the database server.

This property is useful when individual keys in the keystore file have a different password than the keystore file.

Valid Values: string where string is a valid password.

Data Type: String

Default: None

KeyStore

Specifies the directory of the keystore file to be used when SSL is enabled (EncryptionMethod=SSL) and SSL client authentication is enabled on the database server. The keystore file contains the certificates that the client sends to the server in response to the server's certificate request.

This value overrides the directory of the keystore file that is specified by the javax.net.ssl.keyStore Java system property. If this property is not specified, the keystore directory is specified by the javax.net.ssl.keyStore Java system property.

NOTE: The keystore and truststore files can be the same file.

Valid Values: string where string is a valid directory of a keystore file.

Data Type: String

Default: None

KeyStorePassword

Specifies the password that is used to access the keystore file when SSL is enabled (EncryptionMethod=SSL) and SSL client authentication is enabled on the database server. The keystore file contains the certificates that the client sends to the server in response to the server's certificate request.

This value overrides the password of the keystore file that is specified by the javax.net.ssl.keyStorePassword Java system property. If this property is not specified, the keystore password is specified by the javax.net.ssl.keyStorePassword Java system property.

NOTE: The keystore and truststore files can be the same file.

Valid Values: string where string is a valid password.

Data Type: String

Default: None

LoadBalancing

Determines whether the driver uses client load balancing in its attempts to connect to the database servers (primary and alternate). You can specify one or multiple alternate servers by setting the AlternateServers property.

Valid Values: true | false

If true, the driver uses client load balancing and attempts to connect to the database servers (primary and alternate) in random order. The driver randomly selects from the list of primary and alternate servers which server to connect to first. If that connection fails, the driver again randomly selects from this list of servers until all servers in the list have been tried or a connection is successfully established.

If false, the driver does not use client load balancing and connects to each server based on their sequential order (primary server first, then, alternate servers in the order they are specified).

Default: false

Data Type: boolean

LocationName (REQUIRED)

The name of the DB2 location that you want to access.

For DB2 for z/OS, your system administrator can determine the name of your DB2 location using the following command: DISPLAY DDF.

For DB2 for iSeries, your system administrator can determine the name of your DB2 location using the following command. The name of the database that is listed as *LOCAL is the value you should use for this property.

For WRKRDBDIRE, this property is supported only for DB2 for z/OS and DB2 for iSeries.

Valid Values: stringwhere string is the DB2 location.

Default: None

Data Type: String

Alias: DatabaseName property. If both the DatabaseName and LocationName connection properties are specified in a connection URL, the last property positioned in the connection URL is used.

LoginTimeout

The amount of time, in seconds, the driver waits for a connection to be established before returning control to the application and throwing a timeout exception.

Valid Values 0 | x where x is a positive integer.

If 0, the driver does not time out a connection request.

If x, the driver waits for the specified number of seconds before returning control to the application and throwing a timeout exception.

Default: 0

Data Type: int

MaxPooledStatements

The maximum number of pooled prepared statements for this connection. Setting MaxPooledStatements to an integer greater than zero (0) enables the driver's internal prepared statement pooling, which is useful when the driver is not running from within an application server or another application that provides its own prepared statement pooling.

Valid Values: 0 | x where x is a positive integer.

If 0, the driver's internal prepared statement pooling is not enabled.

If set to x, the driver enables the Statement Pool Monitor and uses the specified value to cache a certain number of prepared statements created by an application.

If the value set for this property is greater than the number of prepared statements that are used by the application, all prepared statements that are created by the application are cached. Because CallableStatement is a sub-class of PreparedStatement, CallableStatements also are cached.

Example: If the value of this property is set to 20, the driver caches the last 20 prepared statements that are created by the application.

Default: 0

Data Type: int

Alias: MaxStatements property

MaxStatements

An alias for the MaxPooledStatements property.

PackageCollection

The name of the collection or library (group of packages) to which DB2 packages are bound.

This property is ignored for DB2 for Linux/UNIX/Windows.

Note: This property replaces the CollectionId property; however, the CollectionId property is still recognized for backward compatibility. If both the PackageCollection and CollectionId properties are specified, the CollectionId property is ignored.

See Creating a DB2 Package for more information about creating DB2 packages.

The default is NULLID.

PackageOwner

The owner to be used for any DB2 packages that are created.

See Creating a DB2 Package for more information about creating DB2 packages.

The default is NULL.

Data Type: String

Password

A case-sensitive password used to connect to your DB2 database. A password is required only if security is enabled on your database. If so, contact your system administrator to get your password.

Valid Values: string where string is a valid password. The password is case-sensitive.

Default: None

Data Type: String

PortNumber

The TCP port on which the database server listens for connections. The default is 50000.

ProgramID

The product and version information of the driver on the client to be stored in the database. This value sets the CLIENT_PRDID value in the database. For DB2 V9.1 and higher for Linux/UNIX/Windows, this value is located in the SYSIBMADM.APPLICATIONS table.

Valid Values DDJVVRRM where:

  • DDJ is an identifier for the DataDirect Connect for JDBC driver.

  • VV identifies a 2-digit version number (with high-order 0 in the case of a 1-digit version).

  • RR identifies a 2-digit release number (with high-order 0 in the case of a 1-digit release).

  • M identifies a 1-character modification level (0-9 or A-Z).

Example: DDJ04100

Default: empty stringData Type: String

QueryTimeout

Positive integer, -1, or zero (0). Sets the default query timeout (in seconds) for all statements created by a connection.

If set to a positive integer, the driver uses the value as the default timeout for any statement created by the connection. To override the default timeout value set by this connection option, call the Statement.setQueryTimeout() method to set a timeout value for a particular statement.

If set to -1, the query timeout functionality is disabled. The driver silently ignores calls to the Statement.setQueryTimeout() method.

If set to 0 (the default), the default query timeout is infinite (the query does not time out).

The default is 0.

ReplacePackage

Determines whether the current bind process will replace the existing DB2 packages used by the driver.

For DB2 for Linux/UNIX/Windows, this property must be used in conjunction with the CreateDefaultPackage property.

Valid Values: true | false

If true, the current bind process replaces the existing DB2 packages that are used by the driver.

If false, the current bind process does not replace the existing DB2 packages.

Default: false

Data Type: boolean

ResultSetMetaDataOptions

The DB2 driver can return table name information in the ResultSet metadata for Select statements if your application requires that information.

Valid Values 0 | 1

If set to 0 (the default) and the ResultSetMetaData.getTableName() method is called, the DB2 driver does not perform additional processing to determine the correct table name for each column in the result set. In this case, the getTableName() method may return an empty string for each column in the result set.

If set to 1 and the ResultSetMetaData.getTableName() method is called, the DB2 driver performs additional processing to determine the correct table name for each column in the result set. The DB2 driver also can return schema name and catalog name information when the ResultSetMetaData.getSchemaName() and ResultSetMetaData.getCatalogName() methods are called if the driver can determine that information.

For information about configuring this property for optimal performance, see Performance Considerations.

The default is 0.

Data Type: int

SecurityMechanism (DEPRECATED)

This property is recognized for backward compatibility, but we recommend that you use the AuthenticationMethod property to set the authentication method used by the driver.

SendStreamAsBlob

Determines whether binary stream data that is less than 32K bytes is sent to the database as Long Varchar for Bit Data or Blob data. Binary streams that are larger than 32K bytes can only be inserted into a Blob column. The driver always sends binary stream data larger than 32K bytes to the database as Blob data.

Valid Values: true | false

If true, the driver sends binary stream data that is less than 32K to the database as DB2 Blob data. If the target column is a Long Varchar for Bit Data column and not a Blob column, the Insert or Update statement fails. The driver automatically retries the Insert or Update statement, sending the data as Long Varchar for Bit Data, if the pointer in the stream can be reset to the beginning of the stream. If you know that you are sending the binary stream data to a Blob column, setting this value improves performance.

If false, the driver sends binary stream data that is less than 32K to the database as Long Varchar for Bit Data data. If the target column is a Blob column and not a Long Varchar for Bit Data column, the Insert or Update statement fails. The driver retries the Insert or Update statement, sending the data as Blob data, if the pointer in the stream can be reset to the beginning of the stream.

See Performance Considerations for information about configuring this property for optimal performance.

The default is false.

Data Type: boolean

ServerName (REQUIRED)

Specifies either the IP address in IPv4 or IPv6 format, or the server name (if your network supports named servers) of the database server.

This property is supported only for data source connections.

Valid Values: string where string is a valid IP address or server name.

Example: 122.23.15.12 or DB2ServerDefault: None

Data Type: String

SpyAttributes

Enables DataDirect Spy to log detailed information about calls that are issued by the driver on behalf of the application. Spy is not enabled by default.

Valid Values: (spy_attribute[;spy_attribute]...) where spy_attribute is any valid Spy attribute. See Tracking JDBC Calls with WebLogic JDBC Spy for a list of supported attributes.NOTE: If coding a path on Windows to the log file in a Java string, the backslash character () must be preceded by the Java escape character, a backslash. For example:

log=(file)C:tempspy.log.Example: The following value instructs the driver to log all JDBC activity to a file using a maximum of 80 characters for each line.

(log=(file)/tmp/spy.log;linelimit=80)

Default: None

Data Type: String

StripNewlines

Specifies whether new-line characters in a SQL statement are sent to the DB2 server. If you know that the SQL statements used in your application do not contain newline characters, instructing the driver to not remove them eliminates parsing by the DB2 server and improves performance.

Valid Values: true | false

If true, the driver removes all newline characters from SQL statements.

If false, the driver does not remove any newline characters from SQL statements.

Default: false

Data Type: boolean

See Performance Considerations for information about configuring this property for optimal performance.

TrustStore

Specifies the directory of the truststore file to be used when SSL is enabled using the EncryptionMethod property and server authentication is used. The truststore file contains a list of the Certificate Authorities (CAs) that the client trusts. This value overrides the directory of the truststore file that is specified by the javax.net.ssl.trustStore Java system property. If this property is not specified, the truststore directory is specified by the javax.net.ssl.trustStore Java system property.

This property is ignored if ValidateServerCertificate=false.

Valid Values: string where string is the directory of the truststore file.

Defaul:t None

Data Type: String

TrustStorePassword

Specifies the password that is used to access the truststore file when SSL is enabled using the EncryptionMethod property and server authentication is used. The truststore file contains a list of the Certificate Authorities (CAs) that the client trusts.

This value overrides the password of the truststore file that is specified by the javax.net.ssl.trustStorePassword Java system property. If this property is not specified, the truststore password is specified by the javax.net.ssl.trustStorePassword Java system property.

This property is ignored if ValidateServerCertificate=false.

Valid Values: string where string is a valid password for the truststore file.

Default: NoneData Type: String

UseCurrentSchema

Specifies whether results are restricted to the tables and views in the current schema if a DatabaseMetaData.getTables or DatabaseMetaData.getColumns() method is called without specifying a schema or if the schema is specified as the wildcard character %. Restricting results to the tables and views in the current schema improves the performance of calls for getTables() methods that do not specify a schema.

Valid Values: true | false

If true, results that are returned from the getTables() and getColumns() methods are restricted to tables and views in the current schema.

If false (the default), results of the getTables() and getColumns() methods are not restricted.

See Performance Considerations for information about configuring this property for optimal performance.

The default is false.

Data Type: boolean

User

The case-sensitive user name used to connect to the DB2 database.

Valid Values: string where string is a valid user name. The user name is case-sensitive.Default: None

Data Type: String

ValidateServerCertificate

Determines whether the driver validates the certificate that is sent by the database server when SSL encryption is enabled (EncryptionMethod=SSL). When using SSL server authentication, any certificate that is sent by the server must be issued by a trusted Certificate Authority (CA). Allowing the driver to trust any certificate that is returned from the server even if the issuer is not a trusted CA is useful in test environments because it eliminates the need to specify truststore information on each client in the test environment.

Valid Values: true | false

If true, the driver validates the certificate that is sent by the database server. Any certificate from the server must be issued by a trusted CA in the truststore file. If the HostNameInCertificate property is specified, the driver also validates the certificate using a host name. The HostNameInCertificate property is optional and provides additional security against man-in-the-middle (MITM) attacks by ensuring that the server the driver is connecting to is the server that was requested.

If false, the driver does not validate the certificate that is sent by the database server. The driver ignores any truststore information that is specified by the TrustStore and TrustStorePassword properties or Java system properties.

NOTE: Truststore information is specified using the TrustStore and TrustStorePassword properties or by using Java system properties.

Default: true

Data Type: boolean

WithHoldCursors

Determines whether the cursor stays open on commit—either DB2 leaves all cursors open (Preserve cursors) or closes all open cursors (Delete cursors) after a commit. Rolling back a transaction closes all cursors regardless of how this property is specified.

Valid Values true | false

If true, the cursor behavior is Preserve.

If false, the cursor behavior is Delete.

The default is true.

Data Type: boolean

XMLDescribeType

Determines whether the driver maps XML data to the CLOB or BLOB data type.

Valid Values: clob | blob

If clob, the driver maps XML data to the CLOB data type.

If blob, the driver maps XML data to the BLOB data type.

See Returning and Inserting/Updating XML Data for more information.

The default is clob.

Data Type: String


Performance Considerations

Setting the following connection properties for the DB2 driver as described in the following list can improve performance for your applications:

CatalogIncludesSynonyms

The DatabaseMetaData.getColumns method is often used to determine characteristics about a table, including the synonym, or alias, associated with a table. If your application accesses DB2 v7.x for Linux/UNIX/Windows, DB2 for z/OS, or DB2 for iSeries and your application does not use database table synonyms, the driver can improve performance by ignoring this information. The driver always returns synonyms for the DatabaseMetaData.getColumns() method when accessing DB2 v8.x and higher for Linux/UNIX/Windows.

CatalogOptions

Retrieving synonym information is expensive. If your application does not need to return this information, the driver can improve performance. Default driver behavior is to include synonyms in the result set of calls to the following DatabaseMetaData methods: getColumns(), getExportedKeys(), getFunctionColumns(), getFunctions(), getImportedKeys(), getIndexInfo(), getPrimaryKeys(), getProcedureColumns(), and getProcedures(). If your application needs to return synonyms for getColumns() calls, the driver can emulate getColumns() calls using the ResultSetMetaData object instead of querying database catalogs for the column information. Using emulation can improve performance because the SQL statement formulated by the emulation is less complex than the SQL statement formulated using getColumns().

CatalogSchema

To improve performance, views of system catalog tables can be created in a catalog schema other than the default. The DB2 driver can access the views of catalog tables if this property is set to the name of the schema containing the views. The default catalog schema is SYSCAT for DB2 for Linux/UNIX/Windows, SYSIBM for DB2 for z/OS, and QSYS2 for DB2 for iSeries.

To ensure that catalog methods function correctly, views for specific catalog tables must exist in the specified schema. The views that are required depend on your DB2 database. See Non-Default Schemas for Catalog Methods for views for catalog tables that must exist in the specified schema.

EnableBulkLoad

For batch inserts, the driver can use native bulk load protocols instead of the batch mechanism. Bulk load bypasses the data parsing usually done by the database, providing an additional performance gain over batch operations. Set this property to true to allow existing applications with batch inserts to take advantage of bulk load without requiring changes to the code.

EncryptionMethod

Data encryption may adversely affect performance because of the additional overhead (mainly CPU usage) required to encrypt and decrypt data.

InsensitiveResultSetBufferSize

To improve performance when using scroll-insensitive result sets, the driver can cache the result set data in memory instead of writing it to disk. By default, the driver caches 2 MB of insensitive result set data in memory and writes any remaining result set data to disk. Performance can be improved by increasing the amount of memory used by the driver before writing data to disk or by forcing the driver to never write insensitive result set data to disk. The maximum cache size setting is 2 GB.

MaxPooledStatements

To improve performance, the driver's own internal prepared statement pooling should be enabled when the driver does not run from within an application server or from within another application that does not provide its own prepared statement pooling. When the driver's internal prepared statement pooling is enabled, the driver caches a certain number of prepared statements created by an application. For example, if the MaxPooledStatements property is set to 20, the driver caches the last 20 prepared statements created by the application. If the value set for this property is greater than the number of prepared statements used by the application, all prepared statements are cached.

SendStreamAsBlob

If the large binary objects you insert or update are stored as Blobs, performance can be improved by sending the binary stream as Blob data. In this case, this property should be set to true.

StripNewLines

If you know that the SQL statements used in your application do not contain newline characters, the driver can improve performance by omitting the parsing required to remove them.

UseCurrentSchema

If your application needs to access tables and views owned only by the current user, performance of your application can be improved by setting this property to true. When this property is set to true, the driver returns only tables and views owned by the current user when executing getTables() and getColumns() methods. Setting this property to true is equivalent to passing the user ID used on the connection as the schemaPattern argument to the getTables() or getColumns() call.

Setting the locationName on AS/400

When connecting to a DB2 database running on AS/400, you must set the locationName property:

  1. Obtain the 'Relational Database' value by executing the WRKRDBDIRE command on AS/400.

    You should see output similar to the following:

  2. In the Java client, set up the Properties object with 'user' and 'password' DB2 connection properties (see DB2 Connection Properties).

  3. In Driver.connect(), specify the following string and the Properties object as parameters:

    In this example, RelationalDatabaseName is the value of Database obtained from the result of running the WRKRDBDIRE command.

The following is an excerpt of the Java client:

Creating a DB2 Package

A DB2 package is a control structure on the DB2 server produced during program preparation that is used to execute SQL statements. The DB2 driver automatically creates all DB2 packages required at connection time. If a package already exists, the driver uses the existing package to establish a connection.

Note:

The initial connection may take a few minutes because of the number and size of the packages that must be created for the connection. Subsequent connections do not incur this delay.

When the driver has completed creating packages, it writes the following message to the standard output: DB2 packages created.

By default, DB2 packages created by the DB2 driver contain 200 dynamic sections and are created in the NULLID collection (or library). In most cases, you do not need to create DB2 packages because the DB2 driver automatically creates them at connection time. If required, you can create DB2 packages in either of the following ways:

  • Manually force the DB2 driver to create a package using the WebLogic Server dbping utility. See Creating a DB2 Package Using dbping.

  • Automatically create a package by setting specific connection properties in the connection URL or data source. See Creating a DB2 Package Using Connection Properties.

    Note:

    Your user ID must have CREATE PACKAGE privileges on the database, or your database administrator must create packages for you.

    Your user ID (the user ID listed in the JDBC data source configuration) must be the owner of the package.

    The user ID creating the DB2 packages must have BINDADD privileges on the database. Consult with your database administrator to ensure that you have the correct privileges.

Creating a DB2 Package Using dbping

To create a package on the DB2 server with the Oracle Type 4 JDBC DB2 driver, you can use the WebLogic Server dbping utility. The dbping utility is used to test the connection between your client machine and a DBMS via a JDBC driver. Because the Oracle Type 4 JDBC DB2 driver automatically creates a DB2 package if one does not already exist, running this utility creates a default DB2 package on the DB2 server.

For details about using the dbping utility to create a DB2 package, see 'Creating a DB2 Package with dbping' in Command Reference for Oracle WebLogic Server.

Creating a DB2 Package Using Connection Properties

You can create a DB2 package automatically by specifying specific connection properties in the initial connection URL. Table 3-2 lists the connection properties you should use in your initial connection URL when you create a DB2 package:

Note:

This method is not recommended for use with WebLogic Server JDBC data sources because every connection in the data source uses the same URL and connection properties. When a JDBC data source with multiple connections is created, the package would be recreated when each database connection is created.

Table 3-2 Connection Properties for an Initial Connection URL When Creating DB2 Packages

PropertyDatabase

PackageCollection=collection_name, (where collection_name is the name of the collection or library to which DB2 packages are bound)

DB2 for z/OS and iSeries

CreateDefaultPackage=true

DB2 for Linux/UNIX/Windows, z/OS, and iSeries

ReplacePackage=true

DB2 for Linux/UNIX/Windows

DynamicSections=x, (where x is a positive integer)

DB2 for Linux/UNIX/Windows, z/OS, and iSeries


Using CreateDefaultPackage=TRUE creates a package with a default name. If you use CreateDefaultPackage=TRUE, and you do not specify a CollectionId, the NULLID CollectionId is created.

Note:

To create new DB2 packages on DB2 for Linux/UNIX/Windows, you must use ReplacePackage=true in conjunction with CreateDefaultPackage=true. If a DB2 package already exists, it will be replaced when ReplacePackage=true.

Example for DB2 for Linux/UNIX/Windows:

The following URL creates DB2 packages with 400 dynamic sections. If any DB2 packages already exist, they will be replaced by the new ones being created.

Example for DB2 for z/OS and iSeries:

The following URL creates DB2 packages with 400 dynamic sections.

Notes About Increasing Dynamic Sections in the DB2 Package

A dynamic section is the actual executable object that contains the logic needed to satisfy a dynamic SQL request. These sections are used for handles and prepared statements and the associated result sets.

In some cases, you may need to create DB2 packages with more than the default number of dynamic sections (200). Consider the following information if your application requires DB2 packages with a large number of dynamic sections:

  • Creating DB2 packages with a large number of dynamic sections may exhaust certain server resources. In particular, you may need to increase the database parameter PCKCACHE_SZ to allow the larger packages to be created.

  • The creation of more dynamic sections will slow down the initial creation of the DB2 package.

  • Using DB2 packages with a large number of dynamic sections may impact application performance. If a small number of sections are in use at one time, there will be no impact on the application. If a large number of sections are in use at one time, the performance of the application may decrease because the database will expend resources to check all open sections for locks.

  • As the number of open sections increases, so does the likelihood that a deadlock situation may occur.

  • If your application is mostly executing select statements, it is best to operate in the default mode of automatically committing the database. Dynamic sections are not freed in the DB2 package until the database is committed even if the statements are closed in the application. In this mode the database will commit every time a SQL statement is executed and free all of the sections that were opened. If you need to operate in a manual commit mode, then it is advisable to commit the database as often as possible to ensure that all server resources are freed in a timely manner.

  • Statements cached in the WebLogic Server prepared statement cache will keep sections in use so that the prepared statements can be reused.

  • The DB2 server has a limit on dynamic sections. It is possible to try to create more sections than the server will allow you to create.

Data Types

Table 3-3 lists the data types supported by the DB2 driver and how they are mapped to JDBC data types.

Table 3-3 DB2 Data Types

DB2 Data TypeJDBC Data Type

BigintFoot 1

BIGINT

BinaryFoot 2

BINARY

BlobFoot 3

BLOB

Char

CHAR

Char for Bit Data

BINARY

Clob

CLOB

NOTE: If JDBCBehavior=0, the data type depends on the JVM used by the application: NCLOB (if using Java SE 6) or CLOB (if using another JVM).

Date

DATE

DBClobFoot 4

CLOB

DecfloatFoot 5

DECIMAL

Decimal

DECIMAL

Double

DOUBLE

Float

FLOAT

Graphic

CHAR

NOTE: If JDBCBehavior=0, the data type depends on the JVM used by the application: NCHAR (if using Java SE 6) or CHAR (if using another JVM).

Integer

INTEGER

Long Varchar

LONGVARCHAR

Long Varchar for Bit Data

LONGVARBINARY

Long Vargraphic

LONGVARCHAR

NOTE: If JDBCBehavior=0, the data type depends on the JVM used by the application: LONGNVARCHAR (if using Java SE 6) or LONGVARCHAR (if using another JVM).

Numeric

NUMERIC

Real

REAL

RowidFoot 6

VARBINARY

Smallint

SMALLINT

Time

TIME

Timestamp

TIMESTAMP

Varbinary

VARBINARY

Varchar

VARCHAR

Varchar for Bit Data

VARBINARY

Vargraphic

VARCHAR

NOTE: If JDBCBehavior=0, the data type depends on the JVM used by the application: NVARCHAR (if using Java SE 6) or VARCHAR (if using another JVM).

XML

CLOB

NOTE: If JDBCBehavior=0, the data type depends on the JVM used by the application: SQLXML (if using Java SE 6) or CLOB (if using another JVM).


Footnote 1 Supported only for DB2 v8.1 and v 8.2 for Linux/UNIX/Windows.

Footnote 2 Supported only for DB2 v8.1 and v 8.2 for Linux/UNIX/Windows.

Footnote 3 Supported only for DB2 v8.1 and v 8.2 for Linux/UNIX/Windows, DB2 for z/OS, and DB2 V5R2 and V5R3 for iSeries (see Large Object (LOB) Support).

Footnote 4 Supported only for DB2 v8.1 and v 8.2 for Linux/UNIX/Windows, DB2 7.x v8.1, and v8.2 for z/OS, and DB2 V5R2 and V5R3 for iSeries (see Large Object (LOB) Support).

Footnote 5 Supported only for DB2 v8.1 and v 8.2 for Linux/UNIX/Windows, DB2 7.x v8.1, and v8.2 for z/OS, and DB2 V5R2 and V5R3 for iSeries (see Large Object (LOB) Support).

Footnote 6 Supported only for DB2 for z/OS, and DB2 V5R2 and V5R3 for iSeries.

See Large Object (LOB) Support for more information about the Blob, Clob, and DBClob data types. See Returning and Inserting/Updating XML Data for more information about the XML data type.See Appendix B, 'GetTypeInfo' for more information about data types.

Returning and Inserting/Updating XML Data

For DB2 V9.1 for Linux/UNIX/Windows, the DB2 driver supports the XML data type. By default, the driver maps the XML data type to the JDBC CLOB data type, but you can choose to map the XML data type to the BLOB data type by setting the XMLDescribeType connection property to a value of blob.

Returning XML Data

The driver can return XML data as character or binary data. For example, given a database table defined as:

and the following code:

The driver returns the XML data from the database as character or binary data depending on the setting of the XMLDescribeType property. By default, the driver maps the XML data type to the JDBC CLOB data type. If the following connection URL mapped the XML data type to the BLOB data type, the driver would return the XML data as binary data instead of character data:

Character Data

When XMLDescribeType=clob, XML data is returned as character data. The result set column is described with a column type of CLOB and the column type name is xml.

When XMLDescribeType=clob, your application can use the following methods to return data stored in XML columns as character data:

The driver converts the XML data returned from the database server from the UTF-8 encoding used by the database server to the UTF-16 Java String encoding.

Your application can use the following method to return data stored in XML columns as ASCII data:

The driver converts the XML data returned from the database server from the UTF-8 encoding to the ISO-8859-1 (latin1) encoding.

Note:

The conversion caused by using the getAsciiStream() method may create XML that is not well-formed because the content encoding is not the default encoding and does not contain an XML declaration specifying the content encoding. Do not use the getAsciiStream() method if your application requires well-formed XML.

When XMLDescribeType=blob, your application should not use any of the methods for returning character data described in this section. In this case, the driver applies the standard JDBC character-to-binary conversion to the data, which returns the hexadecimal representation of the character data.

Binary Data

When XMLDescribeType=blob, the driver returns XML data as binary data. The result set column is described with a column type of BLOB and the column type name is xml.

When XMLDescribeType=blob, your application can use the following methods to return XML data as binary data:

The driver does not apply any data conversions to the XML data returned from the database server. These methods return a byte array or binary stream that contains the XML data encoded as UTF-8.

When XMLDescribeType=clob, your application should not use any of the methods for returning binary data described in this section. In this case, the driver applies the standard JDBC binary-to-character conversion to the data, which returns the hexadecimal representation of the binary data.

Inserting/Updating XML Data

The driver can insert or update XML data as character or binary data regardless of the setting of the XMLDescribeType connection property.

Character Data

Your application can use the following methods to insert or update XML data as character data:

The driver converts the character representation of the data to the XML character set used by the database server and sends the converted XML data to the server. The driver does not parse or remove any XML processing instructions.

Your application can update XML data as ASCII data using the following methods:

The driver interprets the data supplied to these methods using the ISO-8859-1 (latin 1) encoding. The driver converts the data from ISO-8859-1 to the XML character set used by the database server and sends the converted XML data to the server.

Binary Data

Class

Your application can use the following methods to insert or update XML data as binary data:

The driver does not apply any data conversions when sending XML data to the database server.

Authentication

Authentication protects the identity of the user so that user credentials cannot be intercepted by malicious hackers when transmitted over the network. See Authentication for an overview.

The DB2 driver supports the following methods of authentication:

  • User ID/password authentication authenticates the user to the database using a database user name and password. Depending on the method you specify, the driver passes one of the following sets of credentials to the DB2 database server for authentication:

    • Encrypted user ID and password

    • User ID in clear text and an encrypted password

    • Both user ID and password in clear text

  • Kerberos authentication uses Kerberos, a trusted third-party authentication service, to verify user identities. Kerberos authentication can take advantage of the user name and password maintained by the operating system to authenticate users to the database or use another set of user credentials specified by the application.

    This method requires knowledge of how to configure your Kerberos environment and supports Windows Active Directory Kerberos and MIT Kerberos.

  • Client authentication uses the user ID of the user logged onto the system on which the driver is running to authenticate the user to the database. The DB2 database server relies on the client to authenticate the user and does not provide additional authentication.

    Note:

    Because the database server does not authenticate the user when client authentication is used, use this method of authentication if you can guarantee that only trusted clients can access the database server.

The driver's AuthenticationMethod connection property controls which authentication mechanism the driver uses when establishing connections. See Using the AuthenticationMethod Property for information about setting the value for this property.

Using the AuthenticationMethod Property

The AuthenticationMethod connection property controls which authentication mechanism the driver uses when establishing connections.

When AuthenticationMethod=kerberos, the driver uses Kerberos authentication when establishing a connection. The driver ignores any values specified by the User property and Password properties.

When AuthenticationMethod=encryptedUIDPassword, AuthenticationMethod=encryptedPassword, or AuthenticationMethod=clearText (the default), the driver uses user ID/password authentication when establishing a connection. The User property provides the user ID. The Password property provides the password. The set of credentials that are passed to the DB2 server depend on the specified value:

  • When AuthenticationMethod=encryptedUIDPassword, an encrypted user ID and encrypted password are sent to the DB2 server for authentication.

  • When AuthenticationMethod=encryptedPassword, a user ID in clear text and an encrypted password are sent to the DB2 server for authentication.

  • When AuthenticationMethod=clearText, both a user ID and a password are sent in clear text to the DB2 server for authentication.

If any of these values are set, the driver also can use data encryption by setting the EncryptionMethod property.

When AuthenticationMethod=client, the driver uses the user ID of the user logged onto the system on which the driver is running when establishing a connection. The DB2 database server relies on the client to authenticate the user and does not provide additional authentication. The driver ignores any values specified by the User property and Password properties.

Configuring User ID/Password Authentication

To configure user ID/password authentication:

  1. Set the AuthenticationMethod property to encryptedUIDPassword, encryptedPassword, or clearText (the default). See Using the AuthenticationMethod Property for more information about setting a value for this property.

  2. Set the User property to provide the user ID.

  3. Set the Password property to provide the password.

Configuring Kerberos Authentication

This section provides requirements and instructions for configuring Kerberos authentication for the DB2 driver.

Product Requirements

Verify that your environment meets the requirements listed in Table 3-4 before you configure the driver for Kerberos authentication.

Table 3-4 Kerberos Authentication Requirements for the DB2 Driver

ComponentRequirements

Database server

The database server must be running one of the following database versions:

  • DB2 v8.1 or higher for Linux/UNIX/Windows

  • DB2 v7.x or higher for z/OS

Kerberos server

The Kerberos server is the machine where the user IDs for authentication are administered. The Kerberos server is also the location of the Kerberos KDC.

  • Network authentication must be provided by one of the following methods:

  • Windows Active Directory on one of the following operating systems:

    Windows Server 2003

    Windows 2000 Server Service Pack 3 or higher

  • MIT Kerberos 1.4.2 or higher

Client

J2SE 1.4.2 or higher must be installed.


Configuring the Driver

During installation of the WebLogic Server JDBC drivers, the following files required for Kerberos authentication are installed in the WL_HOMEserverlib folder, where WL_HOME is the directory in which you installed WebLogic Server:

  • krb5.conf is a Kerberos configuration file containing values for the Kerberos realm and the KDC name for that realm. WebLogic Server installs a generic file that you must modify for your environment.

  • JDBCDriverLogin.conf file is a configuration file that specifies which Java Authentication and Authorization Service (JAAS) login module to use for Kerberos authentication. This file is configured to load automatically unless the java.security.auth.login.config system property is set to load another configuration file. You can modify this file, but the driver must be able to find the JDBC_DRIVER_01 entry in this file or another specified login configuration file to configure the JAAS login module. Refer to your J2SE documentation for information about setting configuration options in this file.

To configure the driver:

  1. Set the AuthenticationMethod property to kerberos. See Using the AuthenticationMethod Property for more information about setting a value for this property.

  2. Modify the krb5.conf file to contain your Kerberos realm name and the KDC name for that Kerberos realm by editing the file with a text editor or by specifying the system properties, java.security.krb5.realm and java.security.krb5.kdc.

    Note:

    If using Windows Active Directory, the Kerberos realm name is the Windows domain name and the KDC name is the Windows domain controller name.

    For example, if your Kerberos realm name is XYZ.COM and your KDC name is kdc1, your krb5.conf file would look like this:

    If the krb5.conf file does not contain a valid Kerberos realm and KDC name, the following exception is thrown:

    The krb5.conf file installed with the WebLogic JDBC drivers is configured to load automatically unless the java.security.krb5.conf system property is set to point to another Kerberos configuration file.

  3. If using Kerberos authentication with a Security Manager on a Java 2 Platform, you must grant security permissions to the application and driver. See Permissions for Kerberos Authentication for an example.

Specifying User Credentials for Kerberos Authentication

By default, when Kerberos authentication is used, the DB2 driver takes advantage of the user name and password maintained by the operating system to authenticate users to the database. By allowing the database to share the user name and password used for the operating system, users with a valid operating system account can log into the database without supplying a user name and password.

There may be times when you want the driver to use another set of user credentials. For example, many application servers or Web servers act on behalf of the client user logged on the machine on which the application is running, rather than the server user.

If you want the driver to use user credentials other than the server user's operating system credentials, include code in your application to obtain and pass a javax.security.auth.Subject used for authentication as shown in the following example.

Obtaining a Kerberos Ticket Granting Ticket

To use Kerberos authentication, the application user first must obtain a Kerberos Ticket Granting Ticket (TGT) from the Kerberos server. The Kerberos server verifies the identity of the user and controls access to services using the credentials contained in the TGT.

If the application uses Kerberos authentication from a Windows client, the application user does not need to explicitly obtain a TGT. Windows Active Directory automatically obtains a TGT for the user.

If the application uses Kerberos authentication from a UNIX or Linux client, the user must explicitly obtain a TGT. To explicitly obtain a TGT, the user must log onto the Kerberos server using the kinit command. For example, the following command requests a TGT from the server with a lifetime of 10 hours, which is renewable for 5 days:

where user is the application user.

Refer to your Kerberos documentation for more information about using the kinit command and obtaining TGTs for users.

Configuring Client Authentication

Set the AuthenticationMethod property to client. See Using the AuthenticationMethod Property for more information about setting a value for this property.

Data Encryption

The DB2 driver now supports SSL encryption for DB2 V5R3 and higher for iSeries. SSL secures the integrity of your data by encrypting information and providing authentication. The DB2 driver supports both SSL server authentication and SSL client authentication.

See SSL Encryption for more information.

Note:

Data encryption may adversely affect performance because of the additional overhead (mainly CPU usage) required to encrypt and decrypt data.

Configuring SSL Encryption

Note:

Connection hangs can occur when the driver is configured for SSL and the database server does not support SSL. You may want to set a login timeout using the LoginTimeout property to avoid problems when connecting to a server that does not support SSL.

To configure SSL encryption:

  1. Set the EncryptionMethod property to SSL.

  2. Specify the location and password of the truststore file used for SSL server authentication. Either set the TrustStore and TrustStore properties or their corresponding Java system properties (javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword, respectively).

  3. To validate certificates sent by the database server, set the ValidateServerCertificate property to true.

  4. Optionally, set the HostNameInCertificate property to a host name to be used to validate the certificate. The HostNameInCertificate property provides additional security against man-in-the-middle (MITM) attacks by ensuring that the server the driver is connecting to is the server that was requested.

  5. If your database server is configured for SSL client authentication, configure your keystore information:

    1. Specify the location and password of the keystore file. Either set the KeyStore and KeyStorePassword properties or their corresponding Java system properties (javax.net.ssl.keyStore and javax.net.ssl.keyStorePassword, respectively).

    2. If any key entry in the keystore file is password-protected, set the KeyPassword property to the key password.

Non-Default Schemas for Catalog Methods

To ensure that catalog methods function correctly when the CatalogSchema property is set to a schema other than the default schema, views for the catalog tables listed in Table 3-5 must exist in the specified schema. The views that are required depend on your DB2 database.

Table 3-5 Catalog Tables for DB2

DatabaseCatalog Tables

DB2 for Linux/UNIX/Windows

SYSCAT.TABLES

SYSCAT.COLUMNS

SYSCAT.PROCEDURES

SYSCAT.PROCPARAMS

SYSCAT.COLAUTH

SYSCAT.TABAUTH

SYSCAT.KEYCOLUSE

SYSCAT.INDEXES

SYSCAT.INDEXCOLUSE

SYSCAT.REFERENCES

SYSCAT.SYSSCHEMATA

SYSCAT.TYPEMAPPINGS

SYSCAT.DBAUTH

DB2 for z/OS

SYSIBM.SYSTABCONST

SYSIBM.SYSTABLES

SYSIBM.SYSSYNONYMS

SYSIBM.SYSCOLUMNS

SYSIBM.SYSPROCEDURES

SYSIBM.SYSROUTINES

SYSIBM.SYSPARMS

SYSIBM.SYSCOLAUTH

SYSIBM.SYSTABAUTH

SYSIBM.SYSKEYS

SYSIBM.SYSINDEXES

SYSIBM.SYSRELS

SYSIBM.SYSFOREIGNKEYS

SYSIBM.SYSSCHEMAAUTH

SYSIBM.SYSDBAUTH

DB2 for iSeries

QSYS2.SYSCST

QSYS2.SYSKEYCST

QSYS2.SYSPROCS

QSYS2.SYSPARMS

QSYS2.SYSTABLES

QSYS2.SYSSYNONYM

QSYS2.SYSCOLUMNS

QSYS2.SQLTABLEPRIVILEGES

QSYS2.SYSKEYS

QSYS2.SYSINDEXES

QSYS2.SYSREFCSTS


Reauthentication

The DB2 driver supports reauthentication for the following databases:

  • DB2 V9.1 and higher for Linux/UNIX/Windows. The user performing the switch must have been granted the database SETSESSIONUSER permission.

  • DB2 v8.1.4 and higher for Linux/UNIX/Windows. The user performing the switch must have been granted the SYSADM permission.

Before performing reauthentication, applications must ensure that any statements or result sets created as one user are closed before switching the connection to another user.

Your application can use the setCurrentUser() method in the ExtConnection interface to switch a user on a connection.

The setCurrentUser() method accepts driver-specific reauthentication options. The options supported for the DB2 driver are:

CURRENT_SCHEMA

Specifies the name of the current schema. The value must be a valid DB2 schema name.

If the setCurrentUser() method is called and this option is not specified or the value is set to #USER#, the schema is switched to the schema of the current user. If the setCurrentUser() method is called and this option is specified as an empty string, only the user is switched; the schema is not switched.

CURRENT_PATH

Specifies the current path for the database to use when locating stored procedures and functions. The value must be a valid path name for the DB2 CURRENT PATH special register.

If the setCurrentUser() method is called and this option is not specified or the value is set to #USER#, the path is switched to the path of the current user. If the setCurrentUser() method is called and this option is specified as an empty string, only the user is switched; the path is not switched.

SQL Escape Sequences

See Appendix C, 'SQL Escape Sequences for JDBC' for information about SQL escape sequences supported by the DB2 driver.

Isolation Levels

The DB2 driver supports the isolation levels listed in Table 3-6. JDBC isolation levels are mapped to the appropriate DB2 transaction isolation levels as shown. The default isolation level is Read Committed.

Table 3-6 Supported Isolation Levels

JDBC Isolation LevelDB2 Isolation Level

None

No CommitFoot 1

Read Committed

Cursor Stability

Read Uncommitted

Uncommitted Read

Repeatable Read

Read Stability

Serializable

Repeatable Read


Footnote 1 Supported for DB2 iSeries versions that do not enable journaling.

Using Scrollable Cursors

The DB2 driver supports scroll-insensitive result sets and updatable result sets.

Note:

When the DB2 driver cannot support the requested result set type or concurrency, it automatically downgrades the cursor and generates one or more SQLWarnings with detailed information.

JTA Support

To use distributed transactions through JTA with the DB2 driver, you must use one of the following database versions:

  • DB2 v8.x and higher for Linux/UNIX/Windows

  • DB2 V5R4 for iSeries

  • DB2 v9.1 for z/OS.

Large Object (LOB) Support

Db2 Jdbc Driver Maven

Retrieving and updating Blobs is supported by the DB2 driver with the following databases:

  • DB2 v8.x and higher for Linux/UNIX/Windows

  • DB2 for z/OS

  • DB2 V5R2 and higher for iSeries

Retrieving and updating Clobs is supported by the DB2 driver with all supported DB2 databases. The DB2 driver supports Clobs up to a maximum of 2 GB with the following DB2 databases:

  • DB2 v8.x and higher for Linux/UNIX/Windows

  • DB2 for z/OS

  • DB2 V5R2 and higher for iSeries

The DB2 driver supports retrieving and updating Clobs up to a maximum of 32 KB with all other supported DB2 databases.

Retrieving and updating DBClobs is supported by the DB2 driver with the following databases:

  • DB2 v8.x and higher for Linux/UNIX/Windows

  • DB2 for z/OS

  • DB2 V5R2 and higher for iSeries

Batch Inserts and Updates

The DB2 driver uses the native DB2 batch mechanism. By default, the methods used to set the parameter values of a batch performed using a PreparedStatement must match the database data type of the column with which the parameter is associated.

DB2 servers do not perform implicit data conversions, so specifying parameter values that do not match the column data type causes the DB2 server to generate an error. For example, to set the value of a Blob parameter using a stream or byte array when the length of the stream or array is less than 32 KB, you must use the setObject() method and specify the target JDBC type as BLOB; you cannot use the setBinaryStream() or setBytes() methods.

To remove the method-type restriction, set the BatchPerformanceWorkaround property to true. For example, you can use the setBinaryStream() or setBytes() methods to set the value of a Blob parameter regardless of the length of the stream or array; however, the parameter sets may not be executed in the order they were specified. Performance may be decreased because the driver must convert the parameter data to the correct data type and re-execute the statement.

Note:

When you create a data source in the Administration Console, the Administration Console sets the BatchPeformanceWorkaround connection property to true by default.

For data sources used as a JMS JDBC store that use the Oracle Type 4 JDBC driver for DB2, the BatchPerformanceWorkaround property must be set to true.

Parameter Metadata Support

The DB2 driver supports returning parameter metadata as described in this section.

Insert and Update Statements

The DB2 driver supports returning parameter metadata for all types of SQL statements with the following DB2 databases:

  • DB2 v8.x and higher for Linux/UNIX/Windows

  • DB2 for z/OS

  • DB2 V5R2 and higher for iSeries

Db2 Jdbc Driver Class Name

For DB2 v7x for Linux/UNIX/Windows and DB2 V5R1 for iSeries, the DB2 driver supports returning parameter metadata for the following forms of Insert and Update statements:

  • INSERT INTO foo VALUES (?, ?, ?)

  • INSERT INTO foo (col1, col2, col3) VALUES (?, ?, ?)

  • UPDATE foo SET col1=?, col2=?, col3=? WHERE col1 operator ? [{AND | OR} col2 operator ?]

where operator is any of the following SQL operators: =, <, >, <=, >=, and <>.

Select Statements

The DB2 driver supports returning parameter metadata for all types of SQL statements with the following DB2 databases:

  • DB2 v8.x and higher for Linux/UNIX/Windows

  • DB2 for z/OS

  • DB2 V5R2 and higher for iSeries

For DB2 v7x for Linux/UNIX/Windows and DB2 V5R1 for iSeries, the DB2 driver supports returning parameter metadata for Select statements that contain parameters in ANSI SQL 92 entry-level predicates, for example, such as COMPARISON, BETWEEN, IN, LIKE, and EXISTS predicate constructs. Refer to the ANSI SQL reference for detailed syntax.

Parameter metadata can be returned for a Select statement if one of the following conditions is true:

  • The statement contains a predicate value expression that can be targeted against the source tables in the associated FROM clause. For example:

  • In this case, the value expression 'bar' can be targeted against the table 'foo' to determine the appropriate metadata for the parameter.

  • The statement contains a predicate value expression part that is a nested query. The nested query's metadata must describe a single column. For example:

The following Select statements show further examples for which parameter metadata can be returned:

ANSI SQL 92 entry-level predicates in a WHERE clause containing GROUP BY, HAVING, or ORDER BY statements are supported. For example:

Joins are supported. For example:

Fully qualified names and aliases are supported. For example:

Stored Procedures

The DB2 driver supports returning parameter metadata for stored procedure arguments.

ResultSet Metadata Support

If your application requires table name information, the DB2 driver can return table name information in ResultSet metadata for Select statements. By setting the ResultSetMetaDataOptions property to 1, the DB2 driver performs additional processing to determine the correct table name for each column in the result set when the ResultSetMetaData.getTableName() method is called. Otherwise, the getTableName() method may return an empty string for each column in the result set.

The table name information that is returned by the DB2 driver depends on whether the column in a result set maps to a column in a table in the database. For each column in a result set that maps to a column in a table in the database, the DB2 driver returns the table name associated with that column. For columns in a result set that do not map to a column in a table (for example, aggregates and literals), the DB2 driver returns an empty string.

The Select statements for which ResultSet metadata is returned may contain aliases, joins, and fully qualified names. The following queries are examples of Select statements for which the ResultSetMetaData.getTableName() method returns the correct table name for columns in the Select list:

The table name returned by the driver for generated columns is an empty string. The following query is an example of a Select statement that returns a result set that contains a generated column (the column named 'upper').

Db2 Jdbc Driver Class Name

The DB2 driver also can return schema name and catalog name information when the ResultSetMetaData.getSchemaName() and ResultSetMetaData.getCatalogName() methods are called if the driver can determine that information. For example, for the following statement, the DB2 driver returns 'test' for the catalog name, 'test1' for the schema name, and 'foo' for the table name:

The additional processing required to return table name, schema name, and catalog name information is only performed if the ResultSetMetaData.getTableName(), ResultSetMetaData.getSchemaName(), or ResultSetMetaData.getCatalogName() methods are called.

Rowset Support

The DB2 driver supports any JSR 114 implementation of the RowSet interface, including:

  • CachedRowSets

  • FilteredRowSets

  • WebRowSets

  • JoinRowSets

  • JDBCRowSets

J2SE 1.4 or higher is required to use rowsets with the driver.

See http://www.jcp.org/en/jsr/detail?id=114 for more information about JSR 114.

Auto-Generated Keys Support

The DB2 driver supports retrieving the values of auto-generated keys. An auto-generated key returned by the DB2 driver is the value of an auto-increment column.

An application can return values of auto-generated keys when it executes an Insert statement. How you return these values depends on whether you are using an Insert statement that contains parameters:

  • When using an Insert statement that does not contain any parameters, the DB2 driver supports the following form of the Statement.execute() and Statement.executeUpdate() methods to instruct the driver to return values of auto-generated keys:

    • Statement.execute(String sql, intautoGeneratedKeys)

    • Statement.execute(String sql, int[]columnIndexes)

    • Statement.execute(String sql, String[]columnNames)

    • Statement.executeUpdate(String sql, intautoGeneratedKeys)

    • Statement.executeUpdate(String sql, int[]columnIndexes)

    • Statement.executeUpdate(String sql, String[]columnNames)

  • When using an Insert statement that contains parameters, the DB2 driver supports the following form of the Connection.prepareStatement method to inform the driver to return the values of auto-generated keys:

    • Connection.prepareStatement(String sql, intautoGeneratedKeys)

    • Connection.prepareStatement(String sql, int[]columnIndexes)

    • Connection.prepareStatement(String sql, String[]columnNames)

An application can retrieve values of auto-generated keys using the Statement.getGeneratedKeys() method. This method returns a ResultSet object with a column for each auto-generated key.

Database Connection Property

The new Database connection property can be used as a synonym of the DatabaseName connection property.

If both the Database and DatabaseName connection properties are specified in a connection URL, the last of either property positioned in the connection URL is used. For example, if your application specifies the following connection URL, the value of the Database connection property would be used instead of the value of the DatabaseName connection property.

DatabaseName Connection Property

The LocationName connection property is only supported when connecting to DB2 for z/OS or iSeries to specify the name of the DB2 location. Now, your application can use the DatabaseName connection property when you are connecting to DB2 for Linux/UNIX/Windows, z/OS, or iSeries.

When connecting to DB2 for Linux/UNIX/Windows, the DatabaseName connection property specifies the name of the database. When connecting to DB2 for z/OS or iSeries, the DatabaseName connection property specifies the name of the DB2 location.

New Data Types

The DB2 driver now supports:

  • New data types for storing graphic data on all DB2 database versions

  • New data types for DB2 v9.1 for z/OS, including the XML data type, which previously was supported only for DB2 V9.1 for Linux/UNIX/Windows

Table 3-7 and Table 3-8 list these data types and describe how they are mapped to JDBC data types.

Table 3-7 DB2 Graphic Data Types

DB2 Data TypeJDBC Data Type

Graphic

CHAR

Long Vargraphic

LONGVARCHAR

Vargraphic

VARCHAR


Table 3-8 New DB2 Data Types Supported for DB2 v9.1 for z/OS

DB2 Data TypeJDBC Data Type

Bigint

BIGINT

Binary

BINARY

Decfloat

DECIMAL

Varbinary

VARBINARY

XML

CLOB


See Appendix B, 'GetTypeInfo' for a description of the data types returned by the getTypeInfo() method.

For more information about using the XML data type, see Returning and Inserting/Updating XML Data.

For information about other data types supported by the DB2 driver, see Data Types.

SQL Procedures for z/OS

SQL Procedures now are supported for DB2 v9.1 for z/OS.

IPv6 Support

The DB2 driver now supports IPv6 for DB2 v9.1 for z/OS.

For more information about IPv6, see Using IP Addresses.

Bulk Load

The driver supports DataDirect Bulk Load, a feature that allows your application to send large numbers of rows of data to the database in a continuous stream instead of in numerous smaller database protocol packets. Similar to batch operations, performance improves because far fewer network round trips are required. Bulk load bypasses the data parsing usually done by the database, providing an additional performance gain over batch operations.