The db2swtch command can be run from any DB2® copy, IBM® data server driver copy, Version 9 or greater. Also, the options -db2 and -client can only be used in Version 9.5 or later.
Prerequisite: 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.
DB2COPY1 is the default name of the DB2 copy that is the first installation of a DB2 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 will 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 will receive default names: IBMDBCL2, IBMDBCL3, and so on.
To change the default DB2 copy using the Default DB2 and Database Client Interface Selection wizard:
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:
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.
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 DB2 copy. If not explicitly referenced, requested database actions will 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.
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 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.
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.
To change the default IBM database client interface copy using the Default DB2 and Database Client Interface Selection wizard:
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:
This procedure unregisters the current default IBM database client interface copy and registers the specified copy as the default IBM database client interface copy.
With no other DB2 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 requestor code will 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 will 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.
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 will show 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.)