When using multiple DB2® copies of DB2 database products or multiple data server driver copies, various options are available for applications to access the DB2 databases. Existing applications will continue to function properly.
Restrictions
Only one copy can be used within the same process for each of the following modes of connecting to databases.
While this topic mainly deals with issues on Windows® operating systems, on Linux® and UNIX® operating systems, you also cannot access instances associated with multiple DB2 copies within the same process.
Procedure
Review the considerations associated with each of the following methods to connect to DB2 databases:
To use a DB2 copy other than the default, in the connection string, specify the IBMDADB driver name for this DB2 copy, which will be of the format: IBMDADB2.$DB2_COPY_NAME. Some applications might not have the ability to change the connection strings without recompiling, therefore these applications will only work with the default DB2 copy. If an application uses the default program id, ibmdadb2, or the default clsid, it will always use the default DB2 copy.
Specifically, you will need to change the value of "provider=IBMDADB2" in the connection string. For example, if the DB2 copy that you want to use is called MY_COPY, you would specify "provider=IBMDADB2.MY_COPY" in the connection string. In case you must explicitly specify a GUID during installation, a response file keyword, OLEDB_GUID, is used to do this and allows you to enter your own GUID. Otherwise, the generated ID is used, as listed in the DB2 installation log.
The IBM Data Server Driver for ODBC and CLI contains the copy name as part of the driver name. The default driver, IBM DB2 ODBC DRIVER, is set to the default IBM database client interface copy. The name of the driver for each installation is "IBM DB2 ODBC DRIVER - Copy Name".
The IBM Data Server Provider for .NET is not accessed by the DB2 database product identified by the copy name. Instead, depending on the version of the provider that the application requires, it finds that version and uses it using the standard methods.
JDBC uses the current version of the driver in the classpath. The Type 2 JDBC driver uses the native DLL. By default, the classpath is configured to point to the default DB2 copy. Running db2envar.bat from the DB2 copy you want to use will update your PATH and CLASSPATH settings for this copy.
The MMC Snap-in starts the DB2 Control Center for the Default DB2 copy.
WMI does not support multiple DB2 copies. You can register only one copy of WMI at a time. To register WMI, follow this process:
WMI is not registered during DB2 installation. You must complete the two registration steps. WMI is a selectable feature in DB2 database products, in DB2 Personal Edition and above. You must select this feature during a customer installation. It is not included in a typical installation.
CLI applications that dynamically load the IBM data server client libraries should use the LoadLibraryEx API with the LOAD_WITH_ALTERED_SEARCH_PATH option, instead of the LoadLibrary option. If you do not use the LoadLibraryEx API with the LOAD_WITH_ALTERED_SEARCH_PATH option, specify db2app.dll in the Path by running db2envar.bat from the bin directory of the DB2 copy that you want to use. For applications that link using db2apie.lib, to use a different DB2 copy, you can use the /delayload option in your link command to delay load db2app.dll and call the db2SelectDB2Copy API before any DB2 calls.
To reduce the number of system tray executables running on the system, by default any items in the system tray that are running in the previous default DB2 copy when the default copy is changed are disabled.