DB2 10.5 for Linux, UNIX, and Windows

Changing the default DB2 and default IBM database client interface copy after installation (Windows)

The db2swtch command can be run from any DB2® copy or IBM data server driver copy.

Before you begin

Multiple DB2 copies (Version 9 or later) or multiple IBM database client interface copies (Version 9.5 or later) are installed on the same computer.

About this task

Example of a DB2 copy that consists of several DB2 database products.

DB2COPY1 is the default name of the DB2 copy that is the first installation of a DB2 database product on your machine. This same name is part of the instance directory where the database manager code and user data is stored.

If there are further DB2 copies installed on your machine, they receive default names DB2COPY2, DB2COPY3, and so on.

Example of an IBM database client interface copy.

IBMDBCL1 is the default name of the IBM® Data Server Driver Package (DSDRIVER) that is the first installation of a driver on you machine.

If there are further DSDRIVER products installed on your machine, they receive default names: IBMDBCL2, IBMDBCL3, and so on.

Changing the default DB2 copy after installation (Windows)
To change the default DB2 copy using the Default DB2 and Database Client Interface Selection wizard:
  1. Open the Default DB2 and Database Client Interface Selection wizard: From a command window, run the db2swtch command without any additional parameters. Or, from the Start Menu, select Programs > IBM DB2 Copy Name > Set-up Tools > Default DB2 and Database Client Interface Selection wizard. The Default DB2 and Database Client Interface Selection wizard opens.
  2. On the Configuration page, select the copy type you want to work with (Default DB2 Copy).
  3. On the default DB2 copy page, select the copy that you want to make the default and click Next to make it the default DB2 copy.
  4. On the summary page, the wizard indicates the result of the operation.
  5. Run the dasupdt command to move the DB2 Administration Server (DAS) to the new default copy.
This procedure switches the current default DB2 copy to the new default DB2 copy and makes the necessary changes to the registry. To access and use the new default DB2 copy, after you have moved the DAS to the new default DB2 copy, open a new command window. You can still access the original default DB2 copy by using the shortcuts in the Start menu for the original default DB2 copy.
To change the default DB2 copy using the command line, you can use db2swtch command:
  • The db2swtch -d new_default_copy_name command is used to change both the default DB2 copy and the default IBM database client interface copy to the new default copy name.
  • The db2swtch -db2 -d new_default_copy_name command is used to change the default DB2 copy to the new default copy name.

This procedure removes registration of the current default DB2 copy and registers the specified DB2 copy as the default DB2 copy. It also makes the necessary changes to the registry, to the environment variables, to the ODBC and CLI drivers and the .NET data provider (when the change also makes the DB2 copy the default IBM database client interface copy), to the WMI registration, and to various other objects, and moves the DAS to the specified default DB2 copy. To access and use the new default DB2 copy, open a new command window.

Differences between Version 9.1 and Version 9.5 when changing the default DB2 copy
In Version 9.1, after you install the first DB2 copy, it becomes the default DB2 copy.
Example of a default DB2 copy.
Any database actions requiring the use of the DB2 server code access the code and the data that is from the default DB2 copy.

In Version 9.1, over time you can install other Version 9.1 or later DB2 copies.

Example of a default DB2 copy when there are multiple DB2 copies present.
However, only one DB2 copy is the default DB2 copy. If not explicitly referenced, requested database actions use the code and data that is from the default DB2 copy. If you want to use the code and data from the other DB2 copies (such as DB2COPY2 or DB2COPY3 in this example) and not from the default DB2 copy (DB2COPY1), then you must explicitly reference the code and data from the other DB2 copies.

In Version 9.5, after you install the first DB2 copy, it becomes the default DB2 copy and the default IBM database client interface copy.

Example of a default DB2 copy and a default IBM database client interface copy.

In Version 9.5, over time you can install other Version 9.5 or later DB2 copies.

Example of a default DB2 copy and a default client copy when there are multiple DB2 copies present.
However, only one DB2 copy is the default DB2 copy or IBM Data Server driver copy. In this case, following the installation of two additional DB2 copies, both defaults remain associated with the original DB2 copy (DB2COPY1).

In Version 9.5, when you have installed more than one DB2 copy, you can choose to have one DB2 copy as the default DB2 copy and a different DB2 copy as the default IBM database client interface copy.

Example of a default DB2 copy and a different DB2 copy as the default client copy when there are multiple DB2 copies present.
If not requiring the code associated with the default IBM database client interface copy (DB2COPY2), then applications or users requiring client interface code must explicitly reference the code that is from one of the other two DB2 copies (DB2COPY1 and DB2COPY3). If not explicitly referenced, the client interface code that is from the default IBM database client interface copy is used.

Changing the default IBM database client interface copy after installation (Windows)
To change the default IBM database client interface copy using the Default DB2 and Database Client Interface Selection wizard:
  1. Open the Default DB2 and Database Client Interface Selection wizard: From the Start Menu, select Programs > IBM DB2 Copy Name > Set-up Tools > Default DB2 and Database Client Interface Selection wizard. Or go to the installdir\bin and run the db2swtch command. The Default DB2 and Database Client Interface Selection wizard opens.
  2. On the Configuration page, select the copy type you want to work with (Default IBM Database Client Interface Copy ).
  3. On the default IBM database client interface copy page, select the DB2 copy or the IBM data server driver copy that you want to make the default so that it is highlighted and click Next to make it the default IBM database client interface copy. (Recall that the code for the IBM database client interface copy was included with the DB2 copy.)
  4. On the summary page, the wizard indicates the result of the operation.
This procedure switches the current default IBM database client interface copy to the new IBM data server driver copy making it the new default IBM database client interface copy. The procedure also makes the necessary changes to the registry. After the switching, the default ODBC and CLI drivers and the .NET data provider will point to the new copy. All the other ODBC drivers with copy name appended can also be accessed.
To change the default IBM database client interface copy using the command line, you can use db2swtch command:
  • The db2swtch -d new_default_copy_name command is used to change both the default DB2 copy and the default IBM database client interface copy to the new default copy name.
  • The db2swtch -client -d new_default_copy_name command is used to change the default IBM database client interface copy to the new default copy name.

This procedure unregisters the current default IBM database client interface copy and registers the specified copy as the default IBM database client interface copy.

Changing the default IBM database client interface copy
In an environment with no other DB2 database products installed, you install the IBM Data Server Driver Package (DSDRIVER).
Example of a default IBM database client interface copy.
By default, the name given to the DSDRIVER is IBMDBCL1.

With no other DB2 database server products (such as Enterprise Server Edition, or Workstation Server Edition) or other DSDRIVERs, this DSDRIVER is the default IBM database client interface copy. Any database actions requiring the use of application requester code access the code and data that is from the default IBM database client interface copy by default.

Over time, you can install DSDRIVERs in other IBM data server driver copies. However, only one IBM data server driver copy (or DB2 copy that is not shown in this example) is the default IBM database client interface copy.

Example of a default client copy when there are multiple IBM database client interface copies present.

If not explicitly referenced, application requests use the code and data that is from the default IBM database client interface copy. If you want to use the code from the other DSDRIVERs (such as IBMDBCL2 or IBMDBCL3 in the example) and not from the default IBM database client interface copy (IBMDBCL1), then you must explicitly reference the code and data from the other DSDRIVERs.

Over time, you can have several DSDRIVERs installed. Only one IBM database client interface copy is the default. At some point, you might decide to switch from one copy and make another copy the default IBM database client interface copy.

Example of switching to a new default client copy when there are multiple IBM database client interface copies present.
Use the switch default DB2 copy and database client interface copy command (db2swtch) to choose and set the new default IBM database client interface copy. Using db2swtch with no arguments starts the Default DB2 and IBM Database Client Interface Selection wizard.

When both IBM database client interface copies and DB2 copies are on your machine
Over time you can have several DSDRIVERs and several DB2 copies installed on your machine. In the scenario presented here, IBMDBCL1 is the default IBM database client interface copy and DB2COPY1 is the default DB2 copy.
Example of multiple IBM database client interface copies and multiple DB2 copies present.

If you want to change either or both defaults, use the db2swtch command with no arguments (Windows only) to start the Default DB2 and IBM Database Client Interface Selection wizard. The wizard shows all possible candidates when choosing a new default. You can also use the db2swtch command with -client or -db2 option to do the switching.

When choosing a new default DB2 copy, in this scenario there is only one other choice: DBCOPY2.

When choosing a new default IBM database client interface copy, in this scenario there are three choices: IBMDBCL2, DB2COPY1, and DB2COPY2. (Recall that DB2 copies have the needed database client interface code to be declare the default IBM database client interface copy.)