问题描述
我正在Windows 7机器上设置一个db2服务器,我不能连接到远程数据库,只能从本地。我想我可能会错过一些配置。
1)我关闭防火墙
2)我的数据库信息是:
数据库2条目:
数据库别名= SAMPLE
数据库名称= SAMPLE
本地数据库目录= C:
数据库发布级别= f.00
注释=
目录条目类型=间接
目录数据库分区号= 0
备用服务器主机名=
备用服务器端口号=
netstat的部分输出-a
命令是:
TCP [::]:49155 WIN-whatever:0 LISTENING
TCP [::]:49164 WIN-whatever:0 LISTENING
TCP [::]:49165 WIN-whatever:0 LISTENING
TCP [::]:50000 WIN-whatever:0 LISTENING
从客户端如果我ping我的服务器它不响应
如果我扫描它 nmap -sV< server_ip_address>
它不返回打开的端口和使用它的服务
客户端,要连接,我运行以下命令:
db2列表节点目录
SQL1027N节点目录不能发现。
目录tcpip节点< i am not sure what does here> remote< server_ip_address> server< port_number>
无输出
这意味着错误。我尝试了一些节点的东西,没有什么工作
我不知道发生了什么,如何解决它。
谢谢帮助
首先,你不能ping服务器和 nmap
没有看到打开的端口意味着你的问题,至少在这一点上,在DB2之外。一旦您修复了网络问题,以下是通过TCP / IP建立到DB2数据库的远程连接的过程。
1)可选。您可以使用服务名称或端口号来配置DB2实例。如果要使用服务名称,在服务器上向 / etc / services
添加一行,类似于 db2c_db2inst1 50000 / tcp
2)在服务器上,输入服务名称db2c_db2inst1更新DB2实例配置: db2 update dbm cfg using svcename db2c_db2inst1
(或 db2 update dbm cfg using svcename 50000
if not使用服务名称)。要验证: db2 get dbm cfg | grep SVCENAME
3)在服务器上更新DB2注册表变量: db2set DB2COMM = TCPIP
。要验证: db2set DB2COMM
。
4)在服务器上发出 db2stop force
,然后 db2start
。
在远程客户端上,假设安装了DB2客户端软件,请发出 db2 catalog tcpip node whatever remote< your server IP address> service< your DB2 port number>
。请注意,节点名称(在本例中为whatever)限制为8个ASCII字符。
6)在远程客户端 db2目录数据库< your database name>在节点任何
,指的是您在步骤5中定义的节点名称(无论)。
7)远程客户端验证连接: db2连接到<您的数据库名称> user<用户名>使用< password>
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 firewall2) 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 respondAlso 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 worksI 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无法连接到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!