Configuration differences between the full profile and Liberty profile: dataSource and jdbcDriver elements
Data source properties with different names
- ifxIFX_LOCK_MODE_WAIT, which is informixLockModeWait in the full profile.
- supplementalJDBCTrace, which is supplementalTrace in the full profile.
Data source properties with different values
- beginTranForResultSetScrollingAPIs, which is true by default in the Liberty profile
- beginTranForVendorAPIs, which is true by default in the Liberty profile
- connectionSharing, which is MatchOriginalRequest by default in the Liberty profile
- statementCacheSize, which is 10 by default in the Liberty profile
connectionSharing property of data sources
- The Liberty profile allows connectionSharing to be configured to either MatchOriginalRequest or MatchCurrentState. By default, it is MatchOriginalRequest.
- The full profile allows connectionSharing to be configured in a finer grained manner, where individual connection properties can be matched based on the original connection request or the current state of the connection. In the full profile, connectionSharing is a combination of bits representing which connection properties to match based on the current state of the connection. In the full profile, a value of 0 means to match all properties based on the original connection request; a value of -1 means to match all properties based on the current state of the connection. The default value for the full profile is 1, which means that the isolation level is matched based on the current state of the connection and all other properties are matched based on the original connection request.
Time duration properties of data source
Time duration properties can optionally be specified with units in the Liberty profile. For example,
<dataSource id="informix" jndiName="jdbc/informix" queryTimeout="5m" ...> <properties.informix ifxIFX_LOCK_MODE_WAIT="120s" .../> </dataSource>See Configuration elements in server.xml for accepted time units and formats of dataSource element. Omitting the units in the Liberty profile is equivalent to the default units used in the full profile.
Configuration for JDBC drivers
- In the Liberty profile, we can take the same approach of configuring different jdbcDriver elements for XA capable and non-XA capable data source implementation classes. Alternatively, we can use a single jdbcDriver element for both. Defining multiple jdbcDriver elements does not cause different class loaders to be used. In the Liberty profile, jdbcDriver elements always use the class loader of the shared library with which they are configured.
- In the full profile, a JDBC provider is defined to point to the JDBC driver JARs, compressed files, and native files. We must define separate JDBC providers for XA capable and non-XA capable data source implementation classes.
For some of the commonly used JDBC drivers, the Liberty profile infers the data source implementation class names based on the names the driver JARs. Therefore, we can omit the implementation class names. For example:
<jdbcDriver id="Derby" libraryRef="DerbyLib"/> <library id="DerbyLib"> <fileset dir="C:/Drivers/derby" includes="derby.jar" /> </library>Use the optional properties of the default implementation classes to override these classes such as javax.sql.DataSource, javax.sql.ConnectionPoolDataSource, and javax.sql.XADataSource.
The following example shows how to override the default javax.sql.XADataSource and javax.sql.ConnectionPoolDataSource implementations that the Liberty profile selects
<jdbcDriver id="Derby" libraryRef="DerbyLib" javax.sql.XADataSource="org.apache.derby.jdbc.EmbeddedXADataSource" javax.sql.ConnectionPoolDataSource="org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource"/> <library id="DerbyLib"> <fileset dir="C:/Drivers/derby" includes="derby.jar" /> </library>See Configuration elements in server.xml for more information about the jdbcDriver element.
Parent topic: Migrate data access applications to the Liberty profile