DB2 无法连接到服务器 [英] DB2 can't connect to the server

查看:78
本文介绍了DB2 无法连接到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Windows 7 机器上设置一个 db2 服务器,但我无法从远程连接到数据库,只能从本地连接.我想我可能会错过一些配置.

1) 我关闭了防火墙2)我的数据库信息是:

数据库 2 条目:

 数据库别名 = SAMPLE数据库名称 = SAMPLE本地数据库目录 = C:数据库发布级别 = f.00评论 =目录条目类型 = 间接目录数据库分区号 = 0备用服务器主机名 =备用服务器端口号 =

netstat -a 命令的部分输出是:

 TCP [::]:49155 WIN-whatever:0 LISTENINGTCP [::]:49164 WIN-whatever:0 监听TCP [::]:49165 WIN-whatever:0 监听TCP [::]:50000 WIN-whatever:0 监听

如果我 ping 我的服务器,客户端没有响应另外,如果我用 nmap -sV <server_ip_address> 扫描它,它不会返回我打开的端口和使用它的服务<​​/p>

为了连接,我从客户端运行以下命令:

db2 列出节点目录SQL1027N 找不到节点目录.目录 tcpip 节点<我不知道这里做什么>远程 <server_ip_address>服务器 <port_number>没有输出

这意味着有问题.我为节点尝试了几件事,但没有任何效果我不知道发生了什么以及如何解决它.

感谢您的帮助

解决方案

首先,你无法 ping 服务器并且 nmap 没有看到打开的端口,这意味着你的问题,在至少在这一点上,位于 DB2 之外.解决网络问题后,您可以按照以下过程通过 TCP/IP 设置到 DB2 数据库的远程连接.

1) 可选.您可以使用服务名称或端口号来配置 DB2 实例.如果要使用服务名称,在服务器上/etc/services 中添加类似于 db2c_db2inst1 50000/tcp 的行,它分配将服务名称db2c_db2inst1"添加到端口 50000.

2) 在服务器上更新 DB2 实例配置:db2 update dbm cfg using svcename db2c_db2inst1(或db2 update dbm cfg using svcename 50000 如果不使用服务名称).验证:db2 get dbm cfg |grep SVCENAME.

3) 在服务器上更新 DB2 注册表变量:db2set DB2COMM=TCPIP.验证:db2set DB2COMM.

4) 在服务器上重新启动实例:发出 db2stop force,然后发出 db2start.

5) 在远程客户端,假设安装了 DB2 客户端软件,发出 db2 catalog tcpip node 不管远程 <你的服务器 IP 地址>;服务<您的 DB2 端口号>.请注意,节点名称(本例中为whatever")限制为 8 个 ASCII 字符.

6) 在远程客户端发出db2目录数据库<你的数据库名称>在节点随便,指的是您在步骤 5 中定义的节点名称(随便").

7) 在远程客户端验证连接:db2 connect to <your database name>用户 <用户名>使用 <密码>

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

解决方案

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>

这篇关于DB2 无法连接到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆