Detailed steps for connecting the DB2 client to the server remotely

Source: Internet
Author: User
Tags db2 client db2 connect db2 connect to table definition

The following describes the remote connection method for the DB2 client, which can run smoothly in windows or linux. This method is for your reference and may be helpful to you,

DB2 client remote connection is assumed as follows:

The client is windows/linux/unix, and db2 or client has been installed on the client.

The server is windows, linux, and unix.

Client ip Address: 192.168.42.147, and Server ip Address: 192.168.42.102

Procedure:

Create a server database node on the client

Run the following command on the client:

Db2 catalog tcpip node test remote 192.168.42.102 server 50000

Note: test is a node defined on the client and its name can be any

192.168.42.102 is the Client ip Address

Port 50000 used by DB2

Find the port used by DB2 on the server,

If the server is linux, you can access the/etc/services file. If your instance is named db2inst1, find the following line:

Db2inst1 50000/tcp

If the server is windows, view X: \ WINNT \ System32 \ drivers \ etc \ services

Database bound to nodes and clients

Run the following command db2 catalog db coshine at node test

Note: coshine is the name of the database you want to connect to on the server.

Test Is the node defined in step 1.

Make binding take effect

Run db2 terminate

Sets the client db2codepage (code page setting), that is, the character encoding.

First query db2codepage on the server side and execute db2set-all

[I] DB2_EXTENDED_OPTIMIZATION = ON

[I] DB2_DISABLE_FLUSH_LOG = ON

[I] AUTOSTART = YES

[I] DB2_STRIPED_CONTAINERS = ON

[I] DB2_HASH_JOIN = Y

[I] DB2COMM = tcpip

[I] DB2CODEPAGE = 819

[I] DB2_PARALLEL_IO = *

We can see that the DB2CODEPAGE on the server is 819, so the client must also set this number.

Run db2set db2codepage = 819

Connect

Run db2 connect to coshine user user_name using password

Note

Db2codepage: db2 database encoding method

Db2codepage = 1386 (Simplified Chinese)
Db2country = 86 (China)

Once a database is created, its code page cannot be changed,

Db2set DB2CODEPAGE = 1386 only the code page environment can be changed, and the database code page cannot be changed
If the connection fails: Check whether the following information is correct.

Make sure you can ping the server: ping 192.168.42.102

Make sure that db2 on the server is started: db2start

Make sure that the client DB2COMM is set to tcpip

First, check the db2comm settings: db2set-all.

If this registry is not set, run db2set db2comm = tcpip

Have you set SVCENAME to the port number or service name in/etc/services?

Run db2 get dbm cfg to check and find the SVCENAME. If the current value is not the server port number or service name, update the settings.

Run: db2 update dbm cfg SVCENAME db2inst1

Note: db2inst1 is the service name, which is db2inst1 50000/tcp in the/etc/services file.
 

DB2 lock compatibility and deadlock

Deep Analysis of DB2 Lock Mechanism

Solution to db2 tablespace lock

How to Create a tablespace in DB2

DB2 temporary table definition method

Related Article

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.