Topic
5 replies Latest Post - ‏2012-08-22T08:31:37Z by SystemAdmin
SystemAdmin
SystemAdmin
2826 Posts
ACCEPTED ANSWER

Pinned topic Using C# to connect to DB2 iSeries: A communication error occurred.

‏2012-08-21T07:41:53Z |
I use IBM.Data.DB2 to connect to a DB2 for i database, but I got the following error, can you help me to solve this issue, thanks a lot

ERROR 08001 IBM SQL30081N A communication error has been detected. Communi
cation protocol being used: "TCP/IP". Communication API being used: "SOCKETS".
Location where the error was detected: "192.xxx.xxx.xx". Communication functio
n detecting the error: "connect". Protocol specific error code(s): "10061", "*"
, "*". SQLSTATE=08001
My C# code is:

DataSet ds = new DataSet();
using (DB2Connection conn = new DB2Connection(strConn))
{
DB2Command cmd = new DB2Command("procName", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("para1", DB2Type.VarChar, 50).Value = "test";
DB2DataAdapter adpt = new DB2DataAdapter(cmd);
adpt.Fill(ds, "Inventory");
return ds;
}
Updated on 2012-08-22T08:31:37Z at 2012-08-22T08:31:37Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    2826 Posts
    ACCEPTED ANSWER

    Re: Using C# to connect to DB2 iSeries: A communication error occurred.

    ‏2012-08-21T08:00:56Z  in response to SystemAdmin
    and the Connection string is "Database=db2db;Server=IPaddress;User ID=db2user;Password=xxxxxxxx"
    • rajxi
      rajxi
      3 Posts
      ACCEPTED ANSWER

      Re: Using C# to connect to DB2 iSeries: A communication error occurred.

      ‏2012-08-21T08:47:30Z  in response to SystemAdmin
      Hi,
      If Data base connection is working fine then this issue may be Access permission is not given for Database user.
      So can u pls try to give Administrator rights to Database user?.

      Thanks
      Ilayaraj
  • SystemAdmin
    SystemAdmin
    2826 Posts
    ACCEPTED ANSWER

    Re: Using C# to connect to DB2 iSeries: A communication error occurred.

    ‏2012-08-21T08:19:12Z  in response to SystemAdmin
    Hi,

    It looks like that you are missing "Port number" in "Server" connection string keyword. The syntax to mention Port number in conn string is: "Database=db2db;Server=IPaddress:PortNumber;User ID=db2user;Password=xxxxxxxx"

    Thanks and regards,
    Devendra
  • SystemAdmin
    SystemAdmin
    2826 Posts
    ACCEPTED ANSWER

    Re: Using C# to connect to DB2 iSeries: A communication error occurred.

    ‏2012-08-22T03:11:38Z  in response to SystemAdmin
    Does anyone know if I can use IBM.Data.DB2 to access iSeries, most of solutions use IBM.Data.DB2.iSeries
  • SystemAdmin
    SystemAdmin
    2826 Posts
    ACCEPTED ANSWER

    Re: Using C# to connect to DB2 iSeries: A communication error occurred.

    ‏2012-08-22T08:31:37Z  in response to SystemAdmin
    Hi,

    You can very well use IBM.Data.DB2 (IBM Data Server Provider for .NET) to access iSeries. You may look into following link for details, e.g. which particular Server versions are supported:
    http://publib.boulder.ibm.com/infocenter/db2luw/v10r1/topic/com.ibm.swg.im.dbclient.adonet.doc/doc/c0010960.html

    I guess you are aware of DB2Connect License to connect to DB2 servers on IBM(r) iSeries(tm):
    http://www.ibm.com/developerworks/wikis/display/DB2/DB2%20and%20.NET%20FAQs#DB2and.NETFAQs-WhatisDB2Connect%3F

    Thanks and regards,
    Devendra