Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

database - DB2 can't connect to the server

I am tring to set up a db2 server on a Windows 7 machine and I cant connect to database from remote, only from local. I think I might miss some configuration.

1) I turned off the firewall 2) my database information is:

Database 2 entry:

 Database alias                       = SAMPLE
 Database name                        = SAMPLE
 Local database directory             = C:
 Database release level               = f.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

Part of the output from netstat -a command is:

  TCP    [::]:49155             WIN-whatever:0      LISTENING
  TCP    [::]:49164             WIN-whatever:0      LISTENING
  TCP    [::]:49165             WIN-whatever:0      LISTENING
  TCP    [::]:50000             WIN-whatever:0      LISTENING

From the client if I ping my server it does not respond Also if I scan it with nmap -sV <server_ip_address> it doesn't return me open ports and services which use it

From the client, to connect, I run the following commands:

db2 list node directory
SQL1027N  The node directory cannot be found.

catalog tcpip node <i am not sure what does here> remote <server_ip_address> server <port_number> 

no output

this implies that something is wrong. I tried couple of things for node and nothing works I am have no idea what is going on and how to fix it.

Thank you for help

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

First of all, the fact that you cannot ping the server and nmap doesn't see the open ports means your problem, at least at this point, lies outside DB2. Once you fix your network issues, here's the procedure you can follow to set up remote connectivity to a DB2 database via TCP/IP.

1) Optional. You can use either a service name or a port number to configure the DB2 instance. If you want to use the service name, on the server add a line to /etc/services similar to db2c_db2inst1 50000/tcp, which assigns the service name "db2c_db2inst1" to the port 50000.

2) On the server update the DB2 instance configuration: db2 update dbm cfg using svcename db2c_db2inst1 (or db2 update dbm cfg using svcename 50000 if not using the service name). To verify: db2 get dbm cfg | grep SVCENAME.

3) On the server update the DB2 registry variable: db2set DB2COMM=TCPIP. To verify: db2set DB2COMM.

4) On the server restart the instance: issue db2stop force, then db2start.

5) On the remote client, assuming the DB2 client software is installed, issue db2 catalog tcpip node whatever remote <your server IP address> service <your DB2 port number>. Note that the node name ("whatever" in this example) is limited to 8 ASCII characters.

6) On the remote client issue db2 catalog database <your database name> at node whatever, referring to the node name ("whatever") that you defined in step 5.

7) On the remote client verify connectivity: db2 connect to <your database name> user <user name> using <password>


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...