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
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.
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:
- 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 . The Default Db2 and Database Client Interface Selection wizard opens.
- On the Configuration page, select the copy type you want to work with (Default Db2 Copy).
- On the default Db2 copy page, select the copy that you want to make the default and click Next to make it the default copy.
- On the summary page, the wizard indicates the result of the operation.
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 copy as the default 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. 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. 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. However, only one Db2 copy is the default copy. If not explicitly referenced, requested database actions use the code and data that is from the default 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 copy (DB2COPY1), then you must explicitly reference the code and data from the other 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.In Version 9.5, over time you can install other Version 9.5 or later Db2 copies. However, only one Db2 copy is the default copy or IBM Data Server driver copy. In this case, following the installation of two additional copies, both defaults remain associated with the original copy (DB2COPY1).In Version 9.5, when you have installed more than one Db2 copy, you can choose to have one copy as the default copy and a different Db2 copy as the default IBM database client interface copy. 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 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:
- Open the Default Db2 and Database Client Interface Selection wizard: From the Start Menu, select . Or go to the installdir\bin and run the db2swtch command. The Default Db2 and Database Client Interface Selection wizard opens.
- On the Configuration page, select the copy type you want to work with (Default IBM Database Client Interface Copy ).
- 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.)
- On the summary page, the wizard indicates the result of the operation.
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). 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.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. 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.
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.)