The Informix Driver
The BEA WebLogic Type 4 JDBC Informix driver is available in the WebLogic Server 8.1 Service Pack 2 and later releases. It is not available with the WebLogic Server 8.1 GA and Service Pack 1 releases.
The following sections describe how to configure and use the BEA WebLogic Type 4 JDBC Informix driver:
- Informix Database Version Support
- Informix Driver Classes
- Informix URL
- Informix Connection Properties
- Sample Connection Pool Configuration
- Data Types
- SQL Escape Sequences
- Isolation Levels
- Using Scrollable Cursors
- Blob and Clob Searches
- Auto-Generated Keys Support
Informix Database Version Support
The BEA WebLogic Type 4 JDBC Informix driver (the "Informix driver") supports:
- Informix Dynamic Server with Universal Data Option 9.2 and higher running on Windows and UNIX via SQLI
- Informix Dynamic Server 2000 9.2, 9.3, and 9.4 running on Windows and UNIX via SQLI
Informix Driver Classes
The driver classes for the BEA WebLogic Type 4 JDBC Informix driver are:
XA: weblogic.jdbcx.informix.InformixDataSource
Non-XA: weblogic.jdbc.informix.InformixDriver
Use these driver classes when configuring a JDBC connection pool in your WebLogic Server domain.
Informix URL
To connect to an Informix database, use the following URL format:
jdbc:bea:informix://dbserver1:1543;informixServer=dbserver1;databaseName=dbnameThe Informix driver also supports the AlternateServers option for connection failover. See Connection Failover with AlternateServers.
Informix Connection Properties
Table 3-1 lists the JDBC connection properties supported by the Informix driver, and describes each property. You can use these connection properties in a JDBC connection pool configuration in your WebLogic Server domain. To specify a property, use the following form in the JDBC connection pool configuration:
property=valueNote: All connection property names are case-insensitive. For example, Password is the same as password.
Property
Description
DatabaseName The name of the database to be used. InformixServer The name of the Informix database server to which you want to connect. LoginTimeoutOPTIONAL 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. Password A case-insensitive password used to connect to your Informix database. A password is required only if security is enabled on your database. If so, contact your system administrator to get your password. PortNumber The TCP port on which the database server listens for connections. The default varies depending on operating system. ServerName The DNS name or IP address of the database server. User The case-insensitive default user name used to connect to your Informix database. A user name is required only if security is enabled on your database. If so, contact your system administrator to get your user name.
Sample Connection Pool Configuration
Table 3-2 lists configuration attributes for a sample WebLogic Server connection pool that uses the non-XA version of the WebLogic Type 4 Informix JDBC driver. Table 3-3 lists configuration attributes for a sample WebLogic Server connection pool that uses the XA version of the driver.
Attribute
Value
URL jdbc:bea:informix://dbserver1:1543;informixServer=dbserver1;databaseName=dbname Driver Class Name weblogic.jdbc.informix.InformixDriver Properties informixServer=dbserver1
user=username
portNumber=1543
DatabaseName=dbname
serverName=dbserver1Password password Statement Cache Size 0 (See Informix Limitation for Prepared Statements for more information.) Target serverName
Attribute
Value
URL jdbc:bea:informix://dbserver1:1543;informixServer=dbserver1;databaseName=dbname Driver Class Name weblogic.jdbcx.informix.InformixDataSource Properties informixServer=dbserver1
user=username
portNumber=1543
DatabaseName=dbname
serverName=dbserver1Password password Statement Cache Size 0 (See Informix Limitation for Prepared Statements for more information.) Target serverName
Informix Limitation for Prepared Statements
If your application drops and recreates tables or changes a table definition, all associated prepared statements must be re-prepared before they can be used again. This is a limitation of the Informix database management system. WebLogic Server does not re-prepare statements that are cached in the statement cache, so if your application uses prepared statements that access tables that are dropped and recreated or for which the definition is changed, re-execution of a cached prepared statement will fail. To avoid the failure, set the Statement Cache Size to 0.
For information about setting the Statement Cache Size, see "Increasing Performance with the Statement Cache in the Administration Console Online Help.
Data Types
Table 3-4 lists the data types supported by the Informix driver and how they are mapped to the JDBC data types.
Informix Data Type
JDBC Data Type
blob BLOB boolean BIT byte LONGVARBINARY clob CLOB char CHAR date DATE datetime hour to second TIME datetime year to day DATE datetime year to fraction(5) TIMESTAMP datetime year to second TIMESTAMP decimal DECIMAL float FLOAT int8 BIGINT integer INTEGER lvarchar VARCHAR money DECIMAL nchar CHAR nvarchar VARCHAR serial INTEGER serial8 BIGINT smallfloat REAL smallint SMALLINT text LONGVARCHAR varchar VARCHAR
SQL Escape Sequences
See SQL Escape Sequences for JDBC for information about the SQL escape sequences supported by the Informix driver.
Isolation Levels
Informix supports isolation levels Read Committed, Read Uncommitted, Repeatable Read, and Serializable. The default is Read Committed.
Using Scrollable Cursors
The Informix driver supports scroll-sensitive result sets, scroll-insensitive result sets, and updatable result sets.
Note: When the Informix driver cannot support the requested result set type or concurrency, it automatically downgrades the cursor and generates one or more SQLWarnings with detailed information.
Blob and Clob Searches
When searching a Clob value for a string pattern using the Clob.position method, the search pattern cannot be greater than 4096 bytes. Similarly, when searching a Blob value for a byte pattern using the Blob.position method, the search pattern cannot be greater than 4096 bytes.
Auto-Generated Keys Support
The Informix driver supports retrieving the values of auto-generated keys. How you return those values depends on whether you are using an Insert statement that contains parameters:
- When using an Insert statement that contains no parameters, the Informix 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 a Insert statement that contains parameters, the Informix 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.