0
votes

I need help in solving the below error that pops out of .NET code when trying to connect DB2 server.

I have installed following nuget packages from manager into my .NET solution.

IBM.Data.DB.Provider version 11.1.3030.4

IBM.Data.DB2 version 10.0.5.5

after that i have following simple code in .NET:

string connectionstr = "Server =test.com:6000; Database = TEST; UID = test; PWD = test;";

DB2Connection obj = new DB2Connection();
        DB2Connection connect = new DB2Connection(connectionstr);

        connect.Open();

I get the following error.

ERROR [08001] [IBM] SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "xx.xx.xx.xx". Communication function detecting the error: "connect". Protocol specific error code(s): "10061", "", "". SQLSTATE=08001

Is it something to do with firewall setting? etc any help would be greatly appreciated. I was trying telnet with the remote db2 server on their port but was not successful.

1
Connection-refused. Verify the port-number (your question shows 6000, do you mean 60000 instead) ? Verify that you can ping the target server from this hostname. Verify that the target Db2-server is listening on that port-number, and is accepting connections from other workstations.mao
thanks for the response I wasnt able to telnet; later today we found that its a DB2 Connect gateway server; so the question now is, from .NET can we connect DB2 connect Server to pull data? or we should be connecting real DB2 server instead?user3264937

1 Answers

0
votes

If your target dataase lives on Db2-for-Z/OS or Db2 for i-Series, then you can use a Db2-connect gateway , as distinct from licensing+configuring a Db2-client appropriate for Z/os or appropriate for i-Series. The Db2-connect has such stuff built in. It pretends to be the target Db2-server and routes all requests and responses so your app or workstation does not need to

The DBA or admin people should have setup the Db2-connect gateway already with details of all the target databases. Your code should connect to the database on the gateway instead (which will autmatically forward to the target Db2 server if the gateway is properly configured).

For CLI/ODBC/DSN connections, you need to catalog the Db2-connect server as a node, then catalog the database(s) on that node. Refer to the online Db2 Knowledge Center for details of the catalog tcpip node and catalog database commands. You only need to catalog if your code references DSNs. So if your code has a full connection string with all the details then you don't need to catalog. But catalog actions are useful for working at the command-line with databases, which often helps with basic problem determination.

This is not a programming matter. It is a configuration matter. Your connection string must reference the gateway hostname/ip-address, the database-name on the gateway that points to the real target, the port-number used by the gateway.

Refer to your onsite support people for all those details, because stackoverflow can't tell you these site specific details.

Study the IBM documentation concerning the Db2-connect gateway (for whatever Db2-connect version you are using) , here is a link.