Connecting to DB2

P

Peter

I am trying to connect to a DB2 database with IBM.Data.DB2 provider and
getting the following message

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: "10.100.1.69".
Communication function detecting the error: "connect". Protocol specific
error code(s): "10061", "*", "*". SQLSTATE=08001

When I use DB2 control center or setup a ODBC connection it works fine
Here is my connection string:

Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password

Does anyone have a solution for this problem, or how to trouble shoot this?


Thank You


Peter
 
N

Nicholas Paldino [.NET/C# MVP]

Peter,

By chance, are you running this in ASP.NET? If so, ASP.NET runs under a
local user ASPNET by default that does not have network access. If your DB
is on another machine, this could definitely be a problem.

The same is true for a program you might have loaded from the internet
or your network (assuming it is not from the machine that the DB is on).

Can you give a little more information about the error?

Hope this helps.
 
W

Willy Denoyette [MVP]

This has nothing to do with network access, integrated security is not used
here, the connection string contains explicit user credentials.

Willy.

message | Peter,
|
| By chance, are you running this in ASP.NET? If so, ASP.NET runs under
a
| local user ASPNET by default that does not have network access. If your
DB
| is on another machine, this could definitely be a problem.
|
| The same is true for a program you might have loaded from the internet
| or your network (assuming it is not from the machine that the DB is on).
|
| Can you give a little more information about the error?
|
| Hope this helps.
|
|
| --
| - Nicholas Paldino [.NET/C# MVP]
| - (e-mail address removed)
|
| | >I am trying to connect to a DB2 database with IBM.Data.DB2 provider and
| >getting the following message
| >
| > 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: "10.100.1.69".
| > Communication function detecting the error: "connect". Protocol
specific
| > error code(s): "10061", "*", "*". SQLSTATE=08001
| >
| > When I use DB2 control center or setup a ODBC connection it works fine
| > Here is my connection string:
| >
| > Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password
| >
| > Does anyone have a solution for this problem, or how to trouble shoot
| > this?
| >
| >
| > Thank You
| >
| >
| > Peter
| >
| >
|
|
 
W

Willy Denoyette [MVP]

|I am trying to connect to a DB2 database with IBM.Data.DB2 provider and
| getting the following message
|
| 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: "10.100.1.69".
| Communication function detecting the error: "connect". Protocol specific
| error code(s): "10061", "*", "*". SQLSTATE=08001
|
| When I use DB2 control center or setup a ODBC connection it works fine
| Here is my connection string:
|
| Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password
|
| Does anyone have a solution for this problem, or how to trouble shoot
this?
|
|
| Thank You
|
|
| Peter
|
|

All I know is that 10061 means "connection refused", don't know what
SQLState 08001 means though.

What kind of client application is this? .NET or other?


Willy.
 
P

Peter

Willy Denoyette said:
This has nothing to do with network access, integrated security is not
used
here, the connection string contains explicit user credentials.

Willy.

in
message | Peter,
|
| By chance, are you running this in ASP.NET? If so, ASP.NET runs
under
a
| local user ASPNET by default that does not have network access. If your
DB
| is on another machine, this could definitely be a problem.
|
| The same is true for a program you might have loaded from the
internet
| or your network (assuming it is not from the machine that the DB is on).
|
| Can you give a little more information about the error?
|
| Hope this helps.
|
|
| --
| - Nicholas Paldino [.NET/C# MVP]
| - (e-mail address removed)
|
| | >I am trying to connect to a DB2 database with IBM.Data.DB2 provider and
| >getting the following message
| >
| > 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:
"10.100.1.69".
| > Communication function detecting the error: "connect". Protocol
specific
| > error code(s): "10061", "*", "*". SQLSTATE=08001
| >
| > When I use DB2 control center or setup a ODBC connection it works fine
| > Here is my connection string:
| >
| > Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password
| >
| > Does anyone have a solution for this problem, or how to trouble shoot
| > this?
| >
| >
| > Thank You
| >
| >
| > Peter
| >
| >
|
|

This is a console application; using same credentials as my ODBC connection
and ODBC works but IBM DB2 provider does not.
Database is on a different machine, database is running on Linux, but I have
no problems connecting to it with the ODBC driver within the same
application.
 
W

Willy Denoyette [MVP]

Could you try to add the "Driver" property in the ConnectionString?

Willy.

|
| ||I am trying to connect to a DB2 database with IBM.Data.DB2 provider and
|| getting the following message
||
|| 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: "10.100.1.69".
|| Communication function detecting the error: "connect". Protocol specific
|| error code(s): "10061", "*", "*". SQLSTATE=08001
||
|| When I use DB2 control center or setup a ODBC connection it works fine
|| Here is my connection string:
||
|| Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password
||
|| Does anyone have a solution for this problem, or how to trouble shoot
| this?
||
||
|| Thank You
||
||
|| Peter
||
||
|
| All I know is that 10061 means "connection refused", don't know what
| SQLState 08001 means though.
|
| What kind of client application is this? .NET or other?
|
|
| Willy.
|
|
 
P

Peter

Willy Denoyette said:
|I am trying to connect to a DB2 database with IBM.Data.DB2 provider and
| getting the following message
|
| 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: "10.100.1.69".
| Communication function detecting the error: "connect". Protocol
specific
| error code(s): "10061", "*", "*". SQLSTATE=08001
|
| When I use DB2 control center or setup a ODBC connection it works fine
| Here is my connection string:
|
| Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password
|
| Does anyone have a solution for this problem, or how to trouble shoot
this?
|
|
| Thank You
|
|
| Peter
|
|

All I know is that 10061 means "connection refused", don't know what
SQLState 08001 means though.

What kind of client application is this? .NET or other?


Willy.

It is .NET console application

This works:

using (OdbcConnection cn = new OdbcConnection("DSN=TestDB2"))
{
cn.Open();
}


This does not work:

using (DB2Connection cn = new
DB2Connection("Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password"))
{
cn.Open();
}
 
N

Nicholas Paldino [.NET/C# MVP]

Willy,

It most certainly does have to do with network access. My response
cited the specific case where it is an ASP.NET application where the worker
process runs under the ASPNET account. That account does not have network
access.

If the database driver is trying to open a socket, then it's going to
fail. It has nothing to do with whether or not it is integrated security.
 
P

Peter

Peter said:
Willy Denoyette said:
|I am trying to connect to a DB2 database with IBM.Data.DB2 provider and
| getting the following message
|
| 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: "10.100.1.69".
| Communication function detecting the error: "connect". Protocol
specific
| error code(s): "10061", "*", "*". SQLSTATE=08001
|
| When I use DB2 control center or setup a ODBC connection it works fine
| Here is my connection string:
|
| Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password
|
| Does anyone have a solution for this problem, or how to trouble shoot
this?
|
|
| Thank You
|
|
| Peter
|
|

All I know is that 10061 means "connection refused", don't know what
SQLState 08001 means though.

What kind of client application is this? .NET or other?


Willy.

It is .NET console application

This works:

using (OdbcConnection cn = new OdbcConnection("DSN=TestDB2"))
{
cn.Open();
}


This does not work:

using (DB2Connection cn = new
DB2Connection("Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password"))
{
cn.Open();
}

Thanks for your help, your questions made me look at the connection string.

I had wrong port #
the port # should be 60000 not 6000, I was missing one zero.


Thank you very much and I am sorry for wasting everyone's time!!!!!!
 
G

Guest

Are you providing the information to connect directly to the server or to
connect to the DB2Connect gateway? You have to go through DB2Connect to
connect with the mainframe.
 
G

Guest

It's never a waste of time. We all learn by researching or even thinking
over others' questions.
--
Dale Preston
MCAD C#
MCSE, MCDBA


Peter said:
Peter said:
Willy Denoyette said:
|I am trying to connect to a DB2 database with IBM.Data.DB2 provider and
| getting the following message
|
| 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: "10.100.1.69".
| Communication function detecting the error: "connect". Protocol
specific
| error code(s): "10061", "*", "*". SQLSTATE=08001
|
| When I use DB2 control center or setup a ODBC connection it works fine
| Here is my connection string:
|
| Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password
|
| Does anyone have a solution for this problem, or how to trouble shoot
this?
|
|
| Thank You
|
|
| Peter
|
|

All I know is that 10061 means "connection refused", don't know what
SQLState 08001 means though.

What kind of client application is this? .NET or other?


Willy.

It is .NET console application

This works:

using (OdbcConnection cn = new OdbcConnection("DSN=TestDB2"))
{
cn.Open();
}


This does not work:

using (DB2Connection cn = new
DB2Connection("Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password"))
{
cn.Open();
}

Thanks for your help, your questions made me look at the connection string.

I had wrong port #
the port # should be 60000 not 6000, I was missing one zero.


Thank you very much and I am sorry for wasting everyone's time!!!!!!
 
W

Willy Denoyette [MVP]

Sorry but you are wrong, It has nothing to do at all with network access:
1. The connection string specifies the credentials used to authenticate with
the DB server, no integrated security is used by the OP, that means that
process identity is (and cannot be) used here.
2. Sockets aren't "secured objects", that is, they aren't protected by the
OS through an ACL, that means an access token is not used, from the systems
point of view everyone can open a socket, so it has nothing to do with a
socket open either.
I have several applications running from asp.net accessing DB servers using
explicit credentials over sockets while ASPNET runs as 'aspnet' or "local
network".


Willy.



message | Willy,
|
| It most certainly does have to do with network access. My response
| cited the specific case where it is an ASP.NET application where the
worker
| process runs under the ASPNET account. That account does not have network
| access.
|
| If the database driver is trying to open a socket, then it's going to
| fail. It has nothing to do with whether or not it is integrated security.
|
| --
| - Nicholas Paldino [.NET/C# MVP]
| - (e-mail address removed)
|
| | > This has nothing to do with network access, integrated security is not
| > used
| > here, the connection string contains explicit user credentials.
| >
| > Willy.
| >
| > in
| > message | > | Peter,
| > |
| > | By chance, are you running this in ASP.NET? If so, ASP.NET runs
| > under
| > a
| > | local user ASPNET by default that does not have network access. If
your
| > DB
| > | is on another machine, this could definitely be a problem.
| > |
| > | The same is true for a program you might have loaded from the
| > internet
| > | or your network (assuming it is not from the machine that the DB is
on).
| > |
| > | Can you give a little more information about the error?
| > |
| > | Hope this helps.
| > |
| > |
| > | --
| > | - Nicholas Paldino [.NET/C# MVP]
| > | - (e-mail address removed)
| > |
| > | | > | >I am trying to connect to a DB2 database with IBM.Data.DB2 provider
and
| > | >getting the following message
| > | >
| > | > 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:
| > "10.100.1.69".
| > | > Communication function detecting the error: "connect". Protocol
| > specific
| > | > error code(s): "10061", "*", "*". SQLSTATE=08001
| > | >
| > | > When I use DB2 control center or setup a ODBC connection it works
fine
| > | > Here is my connection string:
| > | >
| > | > Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password
| > | >
| > | > Does anyone have a solution for this problem, or how to trouble
shoot
| > | > this?
| > | >
| > | >
| > | > Thank You
| > | >
| > | >
| > | > Peter
| > | >
| > | >
| > |
| > |
| >
| >
|
|
 
W

Willy Denoyette [MVP]

No trouble, glad it works.
Just for your own info, the Winsock error "10061" indicates a "connection
refused" error. This is the result of the server actively refusing the
connection request, mostly because the number of connections supported are
exhausted or because the wrong service "port" was selected. In our case it
was the latter.
The SQLSTATE 08001 means "The application requester is unable to establish
the connection".

Willy.

|
| | >
| > | >>
| >> | >> |I am trying to connect to a DB2 database with IBM.Data.DB2 provider
and
| >> | getting the following message
| >> |
| >> | 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: "10.100.1.69".
| >> | Communication function detecting the error: "connect". Protocol
| >> specific
| >> | error code(s): "10061", "*", "*". SQLSTATE=08001
| >> |
| >> | When I use DB2 control center or setup a ODBC connection it works
fine
| >> | Here is my connection string:
| >> |
| >> | Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password
| >> |
| >> | Does anyone have a solution for this problem, or how to trouble shoot
| >> this?
| >> |
| >> |
| >> | Thank You
| >> |
| >> |
| >> | Peter
| >> |
| >> |
| >>
| >> All I know is that 10061 means "connection refused", don't know what
| >> SQLState 08001 means though.
| >>
| >> What kind of client application is this? .NET or other?
| >>
| >>
| >> Willy.
| >>
| >>
| >
| > It is .NET console application
| >
| > This works:
| >
| > using (OdbcConnection cn = new OdbcConnection("DSN=TestDB2"))
| > {
| > cn.Open();
| > }
| >
| >
| > This does not work:
| >
| > using (DB2Connection cn = new
| >
DB2Connection("Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password"))
| > {
| > cn.Open();
| > }
| >
|
| Thanks for your help, your questions made me look at the connection
string.
|
| I had wrong port #
| the port # should be 60000 not 6000, I was missing one zero.
|
|
| Thank you very much and I am sorry for wasting everyone's time!!!!!!
|
|
|
 
P

Peter

Dale said:
Are you providing the information to connect directly to the server or to
connect to the DB2Connect gateway? You have to go through DB2Connect to
connect with the mainframe.

--
Dale Preston
MCAD C#
MCSE, MCDBA


Peter said:
I am trying to connect to a DB2 database with IBM.Data.DB2 provider and
getting the following message

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: "10.100.1.69".
Communication function detecting the error: "connect". Protocol specific
error code(s): "10061", "*", "*". SQLSTATE=08001

When I use DB2 control center or setup a ODBC connection it works fine
Here is my connection string:

Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password

Does anyone have a solution for this problem, or how to trouble shoot
this?


Thank You


Peter

Thank you everyone for your help!!!

Next time I'll know what to check first, unfortunately next time it will be
totally different problem!
 
G

Guest

Hello

I am facing a very different issue with db2 connect.
DBconnection string is
Database=mydatabase;UID=userid;PWD=password;pooling = false

mydatabase is a system DSN created while configuring db2 node.

Sometimes all of sudden i am getting this issue error
"The type initializer for "IBM.Data.DB2.DB2Connection" threw an
exception."

at IBM.Data.DB2.DB2Connection..ctor(String connectionString)
at
Microsoft.Practices.EnterpriseLibrary.Data.DB2.DB2Database.GetConnection()

at
Microsoft.Practices.EnterpriseLibrary.Data.Database.LoadDataSet(DBCommandWrapper command, DataSet dataSet

But after restarting the IIS everything works fine for 1/2 days and
again starts same issue.
In some developer machines i am not at all getting this issue.

#1) asp.net and given permission to IWAM_USR under which worker process
is running.
#2) given permission to SQLLIB folder to IWAM_USR.
#3)Added IWAM_USR to the db2users group.
#4) Reregistered DB2client 8.1.7

plz help me out if u have any solutions..
Thanks in advance

Peter said:
Dale said:
Are you providing the information to connect directly to the server or to
connect to the DB2Connect gateway? You have to go through DB2Connect to
connect with the mainframe.

--
Dale Preston
MCAD C#
MCSE, MCDBA


Peter said:
I am trying to connect to a DB2 database with IBM.Data.DB2 provider and
getting the following message

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: "10.100.1.69".
Communication function detecting the error: "connect". Protocol specific
error code(s): "10061", "*", "*". SQLSTATE=08001

When I use DB2 control center or setup a ODBC connection it works fine
Here is my connection string:

Database=mydatabase;Server=db2server:6000;UID=testuser;PWD=password

Does anyone have a solution for this problem, or how to trouble shoot
this?


Thank You


Peter

Thank you everyone for your help!!!

Next time I'll know what to check first, unfortunately next time it will be
totally different problem!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top