IBM data server client connectivity using multiple copies

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.

About this task


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.


Review the considerations associated with each of the following methods to connect to Db2 databases:
  • OLE DB

    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.
    Note: If you continue to use the IBMDADB2 provider name, then you will only be able to access data sources from the default Db2 copy.
  • IBM® Data Server Driver for ODBC and CLI
    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".
    • You can use only one copy in the same ODBC application at the same time
    • Even when you set up a Data source with the default ODBC driver, it will be configured to access the Db2 copy that was the default at the time the Data source was cataloged.
    • If you move or upgrade instances from one copy to another, you will re-configure the associated Data sources.
  • IBM Data Server Provider for .NET

    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 or SQLJ

    JDBC uses the current version of the driver in the classpath. 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.

  • WMI
    WMI does not support multiple Db2 copies. You can register only one copy of WMI at a time. To register WMI, follow this process:
    • Unregister the WMI Schema extensions.
    • Unregister the COM object.
    • Register the new COM object.
    • Use MOFCOMP to extend the WMI schema.
    WMI is not registered during Db2 installation. You must complete the two registration steps. WMI is a selectable feature in Db2 database products. You must select this feature during a custom installation. It is not included in a typical installation.
  • CLI applications

    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.

  • Db2 System Tray

    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.