简体   繁体   English

DB2:Python ibm_db2正在连接,要使用哪个端口?

[英]DB2 : Python ibm_db2 connecting, which port to use?

I am attempting to connect to a remote db2 instance. 我正在尝试连接到远程db2实例。 I seem to be having connection port issues or protocol issues. 我似乎遇到了连接端口问题或协议问题。 Below is a sample connection setting. 下面是一个示例连接设置。 What is the default connection port using TCPIP & python? 使用TCPIP和python的默认连接端口是什么? I am reaching the server but unable to create a connection to database. 我正在到达服务器,但无法创建与数据库的连接。 Database exists. 数据库存在。

connection = ibm_db.connect("DATABASE=DATABASE_NAME;HOSTNAME=host;PORT=50000;PROTOCOL=TCPIP;UID=username;PWD=password;", "", "")

Im receiving the following error: 我收到以下错误:

Exception: [IBM][CLI Driver] SQL30061N The database alias or database name "DATABASE_NAME " was not found at the remote node. 例外:[IBM] [CLI驱动程序] SQL30061N在远程节点上找不到数据库别名或数据库名称“ DATABASE_NAME”。 SQLSTATE=08004 SQLCODE=-30061 SQLSTATE = 08004 SQLCODE = -30061

The error message seems clear but the cause might vary. 错误消息似乎很清楚,但原因可能有所不同。 Most likely either the database-name or the port-number is incorrect. 数据库名称或端口号很可能不正确。

You get that message if a Db2-server responded indicating Db2 cannot find the specified database on HOSTNAME in the Db2-instance listening on the specified port-number. 如果Db2服务器响应指示Db2在侦听指定端口号的Db2实例中的HOSTNAME上找不到指定的数据库,则会收到该消息。

A Db2-LUW hostname might have more than one Db2-instance running concurrently (each listening on different port-numbers), according to the hardware-resources available. 根据可用的硬件资源,一个Db2-LUW主机名可能同时运行多个Db2实例(每个实例侦听不同的端口号)。

A Db2-Linux/Unix/Windows instance can have many physical databases inside it, each with a distinct name and one or more aliases. 一个Db2-Linux / Unix / Windows实例内部可以有许多物理数据库,每个物理数据库都有不同的名称和一个或多个别名。

Ask your DBA or a colleague for the correct database-name and port-number per hostname. 向您的DBA或同事询问每个主机名的正确数据库名称和端口号。

Alternatively ssh (or remote-desktop) to that hostname, find the owner (userid) of the process listening on port 50,000 (or whatever port you are using), become that userid (for Linux/Unix: use su or sudo ) and use db2 list db directory command to show local databases in that Db2-instance. 将ssh(或远程桌面)替换为该主机名,找到监听端口50,000(或您使用的任何端口)的进程的所有者 (用户ID),成为该用户ID(对于Linux / Unix:使用su或sudo)并使用db2 list db directory命令可显示该Db2实例中的本地数据库。 For Db2-servers on Windows: start > db2cwadmin.bat > db2 list db directory . 对于Windows上的Db2-服务器:开始> db2cwadmin.bat> db2 list db directory。 On Linux/Unix, use ps -ef | grep db2sysc 在Linux / Unix上,使用ps -ef | grep db2sysc ps -ef | grep db2sysc to see how many Db2-instances are running and you can use that information (along with netstat) to discover the port on which they are listening. ps -ef | grep db2sysc可以查看正在运行的Db2实例的数量,您可以使用该信息(以及netstat)来发现它们正在侦听的端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM