Remote Connection DB2 Database

Source: Internet
Author: User
Tags db2 server port

In the DB2 database, you need to understand the concept of catalog (cataloging), before understanding the DB2 database architecture: By the System (node) is the host, the following is an instance, the following is the database, and then the table space, and then the database object. Now suppose you have a database server built on MDMNODE1 machine, you have a client on Windows, Linux or any platform, you now want to establish a client-to-server connection, the following steps:

< first step >

To be able to identify the remote server on the client machine, how to do it?

In DB2, the catalog is used to write the remote server in a file on the local client by cataloging:

Example: (Note: an example of the actual situation in the project adaptation)

Attached

[Email protected] ~]# Cd/home
[[email protected] home]# ls
DASUSR1 db2fenc1 db2inst1 Getsysinfo.jar Helloword.war Mdmappserver01
[Email protected] home]# Su-db2inst1
[Email protected] ~]$ Cd/home

[Email protected] home]$ DB2 catalog TCPIP node MDMNODE1 remote 192.168.124.163 server 60006

Command comment: MDMNODE1 is a node name (must be unique on a machine), remote is the server's IP address, and server is the port number that corresponds to the instance on the remote server. DB2 this way in the local Sqlnodir file to record the remote server information, so the cataloging node is actually the remote server mapping to local, through the records in the Sqlnodir can find the remote server and instance, similar to the remote server and the instance address pointer.

View:

[[Email protected] home]$ DB2 list node Directory node directory number of entries in the directory = 1Node 1 entry:node Name                      = MDMNODE1 Comment                        = Directory Entry Type           = LOCAL Protocol                       = TCPIP Hostname                       = 192.168.124.163 Se Rvice name                   = 60006

  

< Step two >

When the remote server IP address, the instance is cataloged, the second step should be to catalog the database under this instance to local:

[Email protected] home]$ DB2 catalog DB Mdmdb at node mdmnode1db20000i the  Catalog DATABASE command completed success Fully. db21056w  directory changes may isn't effective until the directory cache is refreshed.

Command comment: Mdmdb is a database under a remote instance, Mdmnode1 is the node name we cataloged in the first step

Then look at:

[Email protected] home]$ DB2 list DB directory System Database directory number of entries in the directory = 1Database 1 Entry:database alias                       = Mdmdb database name                        = Mdmdb Node name                            = MDMNODE1 Database release level               = 10.00 C Omment                              = Directory Entry Type                 = Remote Catalog database partition number    = 1 Alternate server hostname            = Alternate Server port Number         =

Next try to connect:

[[Email protected] home]$ DB2 list tables can see all the tables under the current database.

Summarize:

Above is the client and the server is not on the same machine, is through the cataloging node, cataloging the database to achieve the purpose of client connection to the database on the server!

If the connection is on the same machine, then the catalog node is not displayed at this time, but in the server when we create an instance, there is an implicit instance in the local cataloging process, suppose to create an instance named Db2inst1 on p570, there is actually an implied

DB2 catalog Local Node Db2inst1 instance db2inst1 system p570 OSType The steps of AIX, also when you create a database Db2inst1 under MyDB, there is an implied catalog ( Catalog) Database:

DB2 catalog DB MyDB at node Db2inst1 steps.

At this point you can understand the catalog, cataloging is the purpose of establishing a client-to-server database connection locally or remotely.

Reference: How to connect a DB2 database remotely

DB2 using the command line to connect to the remote database (+ use Coolsql connection DB2)

  

  

  

Remote Connection DB2 Database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.