Reputation: 3005
A button on the aspx page checks whether the connection with the DB2 database server is established or not. My connection String is :
Server=xx.xx.xx.xx:446; Database=dd_unit; UID=db2admin; PWD=Secure*888; CurrentSchema=ptdd;
It is throwing me a SQL30081N error message:
- $exception {"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): \"10060\", \"\", \"\". SQLSTATE=08001\r\n"} System.Exception {IBM.Data.DB2.DB2Exception}
I looked for the SQL30081N error and it is due to connection was terminated by the network by the tcp-ip layer. Now, does the problem is with the Connection String or is it something else? Kindly help me solve this issue.
Code: (Its throwing error after connection is opened)
protected void Button3_Click(object sender, EventArgs e)
{
DB2Connection con = new DB2Connection("Server=xx.xx.xx.xx:446; Database=MyDb; UID=MyUser; PWD=MyPass; CurrentSchema=ptdd;");
try
{
con.Open();
Label1.Visible = true;
Label1.Text = "Conection done";
con.Close();
}
catch (Exception)
{
Label1.Text = "connection failed";
}
P.S. I'm using this to test my application
Upvotes: 0
Views: 2880
Reputation: 3005
Port specified was incorrect. It must be 50000 as it is a tcp/ip connection
Upvotes: 1