Configuring DB2 Clients
DB2 provides several different methods for configuring a remote client that needs to access a DB2 database server, as detailed in “Roadmap to Distributed Communications” on page 91. In this section, more details and examples of using these methods will be reviewed.
Automated Configuration Using Discovery
You can use the discovery function of DB2 to automate the addition of remote databases. This can be done in one of two ways:
-
Enter the name of the machine on the network (e.g., the hostname if using TCP/IP and then use discovery to automatically return the instances and databases on that machine (known discovery).
-
Search the network for machines, and then use discovery to automatically return the instances and databases on each machine (search discovery).
You can use either the Configuration Assistant or the Control Center to perform automated configuration. This is an example of using the CA to perform known discovery.
Known Discovery Using the Configuration Assistant (CA)
You can access the CA from the desktop or from the command line using the DB2CA command.
If no databases are yet cataloged on the client, the Welcome panel is displayed (Fig. 3-4). Otherwise, the databases that are cataloged on your client workstation are displayed under Available DB2 Databases in the main CA panel. To add another database, click on the Add button (or the Add Database button from the Welcome panel). The Add Database Wizard panel will appear to guide you through adding the new database.
Figure 3-4. Configuration Assistant (CA) - Add Database Using Wizard...
Figure 3-5. Select how you want to set up a connection
Select the Search the network radio button. Click on the Next button.
If the system is located, then it is displayed under Known Systems, together with all its instances and databases:
You can check if the database server is already known to the client by double clicking on the folder next to Known Systems in Fig. 3-6. If it is not, then click on the Add System button. If it is already known, then expand the system until you see the desired database, as in Fig. 3-8.
Figure 3-6. Select a database from the network search result
Figure 3-7. Select a database from the network search result - Expanded
Figure 3-8. Specify a nickname for the database
Select the database SAMPLE, then click on the Next button.
Choose an alias for the database and optionally add a comment. Click Next.
Figure 3-9. Register this database as a data source
You can register the database as an ODBC data source by checking the “Register this database for ODBC” check box. You can choose an application from the “Optimize for Application” selection box to optimize the ODBC settings for that application. Click Finish when done. You are now able to use the database you added.
Figure 3-10. Configuration Assistant - Test Connection
You can test the connection that has been added by selecting the database alias and clicking on Test Connection.
Figure 3-11. Test connection
You can select multiple ways to test the connection (i.e. CLI and ODBC), enter the user ID and password to be used when connecting to the remote database. On this panel you can also change the password for the user ID defined at the database server machine. If the connection is successful, you will see a pop-up message similar to this:
Figure 3-12. Test connection successful
Search Discovery Using the Configuration Assistant (CA)
Instead of entering the machine identifier (known discovery), you can use the CA to find databases on your local network (search discovery).
Start the Configuration Assistant (CA) and select Add Database Using Wizard.
Select the Search the network radio button. Click on the Next button.
As in the previous example using known discovery, you should first check in the Known Systems to make sure that the database server is not already known to the client.
If the system that contains the database you require is not listed, double click on the folder beside the “Other Systems (Search the network)” icon to search the network for additional systems. When the search is over, the list of discovered systems is displayed. Click on the [+] sign beside the system you require to get a list of the instances and databases defined there (Fig. 3-13). Select the database that you want to add and proceed as shown in the known discovery example.
Figure 3-13. Select a database from the network search result - Other Systems
If the system you want is not listed, it can be added to the list of systems by clicking on the Add Systems push button.
Discovery only supports the TCP/IP protocol.
Using search discovery may appear to be simpler than known discovery. However, in larger networks, routers and bridges can filter the messages search discovery uses to find DB2 servers on the network. This may result in an incomplete or even empty list. In these cases, use known discovery.
Automated Configuration Using Access Profiles
Access profiles are another automated method to configure a DB2 client to access remote DB2 servers and their databases. An access profile contains the information that a client needs to catalog databases on a DB2 server.
As with discovery, when using access profiles, you do not need to provide any detailed communications information to enable the DB2 client to contact the DB2 server.
Two types of access profiles exist:
-
Client access profiles are used for duplicating the cataloged databases and/or the client settings (dbm cfg, CLI/ODBC) from one client to another.
-
Server access profiles are created from DB2 servers and contain information about all the instances and databases the DB2 server has cataloged.
Both types of profiles can be exported and then imported to another DB2 system using the Configuration Assistant. Use of access profiles is typical for configuring a large number of clients.
If you have a large number of clients to configure, you should also consider making use of LDAP (Lightweight Directory Access Protocol). This allows you to store catalog information in one centralized location. Each client just needs to know the centralized location to be able to connect to any database that has been made available in the network. See the DB2 UDB V8.1 Administration Guide for more details about LDAP.
In the Windows environment, DB2 supports Windows Active Directory as the LDAP Server and single sign-on using Kerberos security.
DB2 for OS/390 and DB2 for OS/400 do not support a searched discovery-based configuration. However, if you have a DB2 Connect server already configured with connections to either of these host servers, DB2 Discovery will search for your DB2 Connect server. You can then choose to connect through the DB2 Connect server or use its information to configure a direct connection to the host (if you have the appropriate DB2 Connect software installed on your local client machine).
Using Access Profiles
Access profiles are another automated method to configure a DB2 client to access remote DB2 servers and their databases. An access profile contains the information that a client needs to catalog databases on a DB2 server.
The generation of an access profile requires that the DISCOVER configuration parameter of the DAS service be set to either SEARCH or KNOWN. When the profile is generated, it includes all the instances that have ENABLE in the DISCOVER_INST database manager configuration parameter and all the databases that have the DISCOVER_DB database configuration parameter set to ENABLE. See “Configuring DB2 Discovery” on page 93 for more details about these settings.
The second part of the process is to import the server access profile to one or many client machines. To do this, the profile file must be made available to the DB2 client machine and then be imported using the Configuration Assistant.
The generated file is a text file and can be viewed but should not be changed.
Using the Configuration Assistant to Export a client profile
A client profile can be created by either the Configuration Assistant (CA) or by using the DB2CFEXP command. During the export process, the information necessary to create a connection between the client and server is created. The information in the client profile can then be imported to configure other clients.
Fig. 3-14 shows the Configuration Assistant, by clicking on Export Profile, the following options are given:
-
All - this will create a profile that contains all the databases cataloged on the system
-
Database connection information - this will create a profile that contains all of the databases cataloged on the system without any of the configuration information for this client
-
Customize - will allow you to select specific databases that are cataloged on the system
Figure 3-14. Configuration Assistant - Export Profile
For this example, select Customize
Figure 3-15. Customize Export Profile
Enter the name of the file where the information will be exported to, you can select specific parameters to be exported. If you click on DBM configuration parameters and then Customize, you will see the following screen:
Figure 3-16. DBM Configuration
The DBM Configuration panel allows the user to select a number of configuration parameters and change its value. Click OK to return and then click Export
Figure 3-17. Export Results
This final panel shows the results of the Export command. The generated file is a text file and can be viewed but should not be changed.
Using the Configuration Assistant to Import a client profile
A client access profile can be used to configure a client by using the import function of the Configuration Assistant (CA) or by using the DB2CFIMP command. Clients can import all or a subset of the configuration information from a given profile.
Start the Configuration Assistant, and click on Import.
Figure 3-18. Import Profile
By clicking on Import Profile, you are given the following options:
-
All - this will import all information from a given profile
-
Customize - this will allow you to select which parameters you want imported to your system.
Figure 3-19. Customize Import Profile
In this panel, select a file that contains the client information to import to this system and click Load. This will present you with the parameters found in the import file. You can choose which configuration parameters to import. Click Import.
Figure 3-20. Import Results
The status of the configuration parameters selected by Import are displayed.
Using the Configuration Assistant to Import a server profile
A server access profile is a file that contains information about all the instances on the DB2 server and all the databases within each instance.
Start the Configuration Assistant and select Add Database Using Wizard.
Figure 3-21. Select how you want to set up a connection
Select the Use a profile radio button and click Next.
Figure 3-22. Select a database from a profile
Select a server profile to load, click on Load, then select a database and click on Next.
Figure 3-23. Specify a nickname for the database
Enter a unique name for the database alias for the system. Click on Next.
Figure 3-24. Register this database as a data source
If the system will be using ODBC, register this database as an ODBC data source. Click Finish to exit.
Manual Configuration
It is also possible to manually configure a database connection. To manually configure the connection, you must know the following:
-
One of the protocols supported by the server instance containing the database
-
The protocol connection information required to configure the connection to the server instance
-
The server name
-
The name of the database on the remote server
There are two ways to manually configure connections:
-
Using the Manual option in the Configuration Assistant - in this case, you are prompted via a GUI interface for all the values to enter.
-
Using the CATALOG NODE/DB commands - in this case, you must know the syntax of the commands and enter the commands from a command line interface. The advantage of using the CATALOG NODE/DB commands is that the configuration steps can be put into scripts so that the configuration can be redone if necessary.
In either case, manual configuration must be used to exploit some advanced options that are not available using automated methods; for example, choosing the location where authentication should take place.
Manual configuration using the CA will now be reviewed. With the information listed above, the Add Database Wizard can be used to guide you through the steps necessary to add the database connection.
Manual Configuration Using the Configuration Assistant
Start the Configuration Assistant (CA) and click on Add in the CA's main panel to start the Add Database Wizard. Select Manually configure a connection to a DB2 database and click on Next.
Figure 3-25. Select a communications protocol
Select the protocol that you will use to connect to the database.
All of the protocols that DB2 supports are listed here, including APPC. If you have chosen APPC, your operating system choices are LAN-based, OS/390 or z/OS, OS/400, VM, or VSE. If you choose TCP/IP, your choices are LAN-based, OS/390, OS/400, or VM.
Click on Next.
Figure 3-26. Specify TCP/IP communication parameters
Enter the required protocol parameters. These parameters differ according to the protocol selected. These are the supported protocols together with their associated parameters:
-
TCP/IP - Server hostname/IP address, port number
-
NetBIOS - Server workstation name, adapter number
-
Named Pipe - Server computer name, instance
-
APPC - Server symbolic destination name
You should check that the machine is properly configured on the network before clicking on OK. For example, if using TCP/IP, ping the hostname to check if it is available.
Click on the Next button.
Figure 3-27. Specify the name of the database to which you want to connect
Enter the name of the database (as known at the server) in the Database Name field.
You can accept the same name as the local alias for the database or change the alias to a name of your choice. You can also enter a description.
On this panel (Figure 3-28) you can enter the ODBC settings.
Figure 3-28. Register this database as a data source
Figure 3-29. Specify the node options
This panel allows you to enter options relating to the remote node. You should fill in these values as they affect the behavior of the Control Center. The system and instance names are given by the values of DB2SYSTEM and DB2INSTANCE at the server. You should also select the operating system of the remote system.
Figure 3-30. Specify the system options
Enter system options relating to the database server, including system name, host name, and the operating system.
Figure 3-31. CA manual configuration - Enter security options
In the final panel, there are many options relating to security that may be specified.
You can specify whether authentication of the user takes place as specified in the server's database manager configuration file (the default), at the client, at the server, or by Kerberos. These options are explained in more detail in “Controlling Data Access” on page 135. You can also choose to use SOCKS security for TCP/IP connections, which allows you to access a remote database outside your firewall.