ArticleDirectory
- An example of a federated database!
From: http://bbs.51cto.com/archiver/tid-496967.html
An example of a federated database!
The understanding of the federated database is not mentioned!
The following is an example for Configuration:
The process of creating a 3.40-based federated database on MySQL 4.5:
1. Set the federated database Switch
DB2 update dBm CFG using federated Yes
Db2stop
Db2start
DB2
2. Create a "packer" for the remote database ":
Create wrapper drda
-- Drda is the name
3.
Define a federated Server
Create server tstsvr
Type DB2/AIX -- Database Type
Version 8.1 -- version
Wrapper drda authorization "db2admin" password "..." Options (node 'server', dbname 'DW ');
--
Authorization is a remote database user
-- Password is the password
-- Node maps a remote instance to a local node.
-- Dbname indicates the database name under the remote instance.
Commit;
4. create user ing for federated Authentication
-- Create user mapping for "db2admin" server tstsvr options (remote_authid 'db2admin', remote_password '....');
-- Commit;
Create user mapping for "db2admin" -- db2admin is a local user
Server tstsvr
Options
(Remote_authid 'db2admin', -- the remote user name is consistent with 3
Remote_password 777400419419456990610222 -- the remote secret is the same as 3, but there is an encryption process here.
);
5. Table alias-"ticket" for accessing a remote table"
Create nickname cust_type_c1_z for tstsvr. db2admin. cust_group_c1_z;
Commit;
6. The test is as follows:
Select * From cust_type_c1_z;
-- Auther: Z. X. t
-- Premise: Use the Quest Center to configure the 3.40 catalog on 4.5. If there is no Quest Center, use the following command to configure
-- As follows:
1. Create a node instance
Catalog TCPIP node Server
Remote 192.168.4.5
Servers 50000
Remote_instance DB2
Ostype NT;
2. Create a database under an instance
Catalog Database DW
As DW
At node Server
Authentication server;
Another article:
Federated database access remote DB2
Assume that two environments are host1 and host2.
Host1, Local Machine
IP: 192.168.1.192
DB2 instance: db2inst1
DB2 DB: local_db
Host2, remotely accessed Machine
IP: 192.168.1.195
DB2 instance: db2inst1 (Port = 50000, Pwd = db2inst1)
DB2 DB: remote_db
Table: t_usertable
Now, you need to access the table t_usertable on remote host2 in the local_db database of host1.
First, you must catalog the host2 node and the remote_db database on host1.
DB2 catalog TCPIP node node_195 remote 192.168.1.195 server 50000
DB2 catalog dB remote_db as remote_db_195 at node node_195
DB2 terminate (this command must be used otherwise catalog update may not take effect)
Then test the connectivity to host2 on host1.
DB2 connect to remote_db_195 user db2inst1 using db2inst1
DB2 connect Reset
Modify the instance configuration parameters of host1 and host2 and restart the instance.
DB2 update dBm CFG using fed_noauth Yes
Db2stop
Db2start
Connect to the local_db database on host1
DB2 connect to local_db
(Local UNIX environment) Create wrapper drda;
(Windows) Create wrapper "drda" library 'db2drda. dll 'options (add db2_fenced 'n ');
Create server remoteserver_195 type DB2/UDB version '8. 2' wrapper drda authorization "db2inst1" password "db2inst1" Options (dbname 'remote _ db_195 ', password 'y ');
Create user mapping for "db2inst1" server remoteserver_195 options (add remote_authid 'db2inst1', add remote_password 'db2inst1 ');
Create nickname remote_t_usertable for remoteserver_195.db2inst1.t_usertable;
(Wrapper uses the default name of the DB2 data source. The name of drda server is remoteserver_195, And the nickname of the t_usertable table in the local_db database is remote_t_usertable)
In the default db2inst1 mode, you can log on to local_db on the host 1, and query the remote_t_usertable table.
DB2 'select * From db2inst1. remote_t_usertable'
DB2 connect Reset