DB2 can't connect to the server

匿名 (未验证) 提交于 2019-12-03 02:23:02

问题:

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

回答1:

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>



回答2:

Try to do a telnet on the instance port to check that everything is right from the client to the server

telnet DB2-Server-name 50000 

Where DB2-Server-name is the server name or IP address. Make sure you can get the server. 50000 is the most often DB2 port, but you have to check the configuration.

Once you get connection to the server, you can configure the node with the previous answer.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!