DB2 Data Sync online Help
Prev | Return to chapter overview | Next |
Connecting to the target database
To setup a connection to a DB2 database stored on a remote server, you need:
1. Get any DB2 client with ODBC driver installed on your computer. We recommend to use clients with the DB2 Command Line Processor (CLP) tool. It seems that IBM Data Server Runtime Client is the best solution in this situation. It is free and is not overloaded with various drivers. To obtain this client, visit the publisher's site and download IBM Data Server Runtime Client (Windows 32-bit AMD and Intel x86).
2. Get this database catalogued by db2 on the client machine. The DB2 client can work only with catalogued databases assumed with cataloged nodes (servers). To work with a DB2 database with DB2 Data Sync, you have to get this database catalogued on the client machine (the operation is accomplished only once) and to specify the name of user registered on DB2 server and the corresponding password. To catalogue a DB2 database, follow the steps below:
2.1 Catalog the node of server. To get all the catalogued nodes of the client machine, enter the following command to the DB2 Command Window or similar (It's time to use DB2 Command Line Processor ;) ):
db2 list node directory
To catalog a new server node, use the following command:
db2 catalog tcpip node <nodename> remote <hostname or ip address>
server <db2servicename> [remote <instance_name> ostype <OSname>]
nodename – the node name to be used on your computer
hostname or ip address – hostname/ipaddress of server storing the DB2 database
db2servicename – ServiceName or port number of db2instance (db2 get dbm cfg | grep SVCENAME)
instance_name – instance name of db2 database.
OSname – Solaris,windows, AIX, Linux etc.
Example:
db2 catalog tcipnode testnode remote testhost server 50000
db2 catalog tcipnode testnode remote testhost server 50000 remote db2inst1
2.2 Catalog the necessary database on the corresponding node. To get the list of catalogued databases, use the following command:
db2 list db directory
To add the necessary database to the catalog, enter the following command:
db2 catalog database <dbname> as [<db_alias>] at node <nodename>
dbname – database name
db_alias – optional database alias, if you want database name different on client.
nodename – nodename you created on first step
Example:
db2 catalog database testdb as testdb at node testnode
db2 catalog database sample at node testnode
Prev | Return to chapter overview | Next |