0
votes

I am attempting to connect to a remote db2 instance. 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? 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. SQLSTATE=08004 SQLCODE=-30061

1

1 Answers

1
votes

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.

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.

A Db2-Linux/Unix/Windows instance can have many physical databases inside it, each with a distinct name and one or more aliases.

Ask your DBA or a colleague for the correct database-name and port-number per hostname.

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. For Db2-servers on Windows: start > db2cwadmin.bat > db2 list db directory . On Linux/Unix, use 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.