Database connection acquisition for utilities and Ant tasks

WebSphere Commerce utilities and Ant tasks are updated to reference a single class to configure the acquisition of a database connection. This unified database connection method ensures that each utility and Ant task can reference this class to acquire a database connection, regardless of the JDBC driver that a database uses. You do not need to complete any further action before these utilities and processes begin to use the AllDBConnector class to help acquire a database connection.

By default, we can specify the connection parameters for a database from the command line, or the utility can construct the parameters. With this unified connection method, these options for specifying the database for use with a utility are not modified. We can still log all of the database connections that are made by a utility. To set where to create the log files, use the logoutput element as a subelement of the database-type configuration. With this logging setup, the log file records the database specifications that are input to establish a database connection for a utility. Once a set of input parameters are collected, we can review the specified parameters and potentially configure overrides to control how utilities connect to the database. For instance, we can override the database specification to ensure that utilities only use a specific JDBC URL.

(Oracle) We can configure the AllDBConnector class to use an Oracle wallet to authenticate user credentials for connecting to an Oracle database. By configuring the AllDBConnector class to authenticate users with an Oracle wallet, we can make the database connection process for WebSphere Commerce utilities more secure. For more information about this configuration, see Configure the Oracle database connection for utilities to authenticate users with Oracle Wallet.


Database connection acquisition configuration

The configuration properties for this unified database connection method are specified within following file:

To review the XML schema to help you understand how utilities or Ant tasks establish a database connection, go to the following path and open the file for review:

The database connection configuration properties are set as name-value pair elements within the alldbconnector.xml XML configuration file. These properties are set as both global properties and as part of the specific database type configurations. When a database connection is established, the connection uses the configuration settings for the specific database input identifier. If no configuration for that identifier exists, the connection uses the global configuration properties. The following code provides an outline of the configuration XML file schema:

To change how utilities acquire a database connection, configure the properties within the configuration XML file. For each of the 5 supported database types, the following elements can be included within each database type element:

Where:


Configuration property overrides

The following code snippet specifies the input parameters to connect the stagingprop utility to a database. These parameters set the values for the -sourcedb and -destdb parameters:

To configure overrides for these parameters, use the parameter values 'mall', 'localhost:5000/mall', and 'jdbc:db2://localhost:50000/mall' as the value for the override configuration identifier elements. Within the override configuration, we can set custom connection parameters or a different JDBC URL. If the override does not exist, or does not contain a JDBC URL element, the utility constructs the JDBC URL from the specified input parameters. However, If a JDBC URL exists in an applicable override element, the stagingprop utility uses the configured JDBC URL instead of constructing a URL from the input parameters.

Note: Depending on performance requirements, your system might use a local 64-bit database server. If your system uses a 64-bit database server with a 32-bit Java virtual machine (JVM), certain utilities and installation processes might fail. For instance, utility processes can fail if the only database connection input parameter that the utility or process specifies when attempting to establish a database connection is the database name. In these situations, the problem can be resolved by configuring an override with the database name as the override identifier value and using a jdbc subelementFor example, certain database types, such as a DB2 for Linux, UNIX, and Windows database, the database name specification, or the type-2 JDBC URL specification forces the use of the type-2 JDBC driver. The use of a type-2 JDBC driver requires loading native libraries. An attempt to load a native library can fail when the JVM is 32-bit and the database server is 64-bit. Using libraries to look up the database server name and port number to construct a type-4 JDBC URL can also fail because this process also requires the loading of native libraries. We can resolve this problem by configuring an override with the database name as the override identifier value, or by completing one of the following tasks:


DB2 pureScale support

Beginning with WebSphere Commerce Version 7 Fix Pack 8, all WebSphere Commerce utilities support the use of a DB2 pureScale database. When creating an instance on a DB2 for Linux, UNIX, and Windows pureScale database, the instance creation process adds the following connection properties to the WebSphere Commerce data source:

If Content Management is also enabled, the instance creation process also adds the properties to the WebSphere Commerce Publish data source.

When creating an instance with a DB2 pureScale database, the process adds override elements within the alldbconnector.xml configuration file. The override elements contain the same elements that are added to the WebSphere Commerce data source and includes the appropriate JDBC URL information. We can review the full list of connection properties that are set to support a DB2 pureScale database within the ConnectionPropertyConfig and CMConnectionPropertyConfig targets in the following files:


Example

The following configuration XML file sets the properties that the alldbconnector class uses to configure how utilities acquire a database connection. The following configuration specifies overrides for two databases that are cataloged on a local DB2 for Linux, UNIX, and Windows database server.

On the local instance, the first database is cataloged as 'mall' and the second database as 'prodmall'. The alias 'mall' refers to a local database that is named 'mall', while the alias 'prodmall' refers to a remote database 'mall' that is on a host, which is named 'prodserver'. On the 'prodserver' host, the DB2 remote connection service operates on port '50000'. The local database server is on a host named 'stagingserver'. On the 'stagingserver' host, the database connection service is operational on port '50000'.

If any connection parameters specified for a utility match the override configurations, the properties set within the override configurations are used to acquire a database connection.