IBM DB2 Connector throws exception with .Connect() in .net

C

C.E.O. Gargantua

I am using the IBM DB2 Connector class of the Redistributable DB2
Run-Time Client Lite in a c# .net application using Visual Studio.

Running the code:

string myConnString = "DATABASE=192.168.1.43;UID=XXXX;PWD=XXXX";
DB2Connection myConnection = new DB2Connection(myConnString);
myConnection.Open();

Throws this error on the .Open() method:

IBM.Data.DB2.DB2Exception: ERROR [HY009] [IBM] CLI0124E Invalid
argument value. SQLSTATE=HY009
at IBM.Data.DB2.d.a(String A_0, Int32 A_1, IsolationLevel A_2,
DB2Connection A_3)
at IBM.Data.DB2.DB2ConnPool.a(DB2Connection A_0, String A_1, a& A_2,
Object& A_3)
at IBM.Data.DB2.DB2Connection.Open()
at dot400.Form1.processSqlRequest(String qs, Int32 q) in
c:\documents and settings\jbailo\my documents\visual studio
projects\dot400\form1.cs:line 205


How can I diagnose this?

Does my connection string look right?

The machine name on our network is AS400. If I use that as the
DATABASE name, it throws another error:

IBM.Data.DB2.DB2Exception: ERROR [58031] [IBM] SQL1031N The database
directory cannot be found on the indicated file system. SQLSTATE=58031

at IBM.Data.DB2.d.a(String A_0, Int32 A_1, IsolationLevel A_2,
DB2Connection A_3)
at IBM.Data.DB2.DB2ConnPool.a(DB2Connection A_0, String A_1, a& A_2,
Object& A_3)
at IBM.Data.DB2.DB2Connection.Open()
at dot400.Form1.processSqlRequest(String qs, Int32 q) in
c:\documents and settings\jbailo\my documents\visual studio
projects\dot400\form1.cs:line 205


I can access this as400 using OleDb ( the SQLDA400 data provider that is
part of the CAE ), but I want to deploy my application using the


Here is the connector class api doc:

http://publib.boulder.ibm.com/infoc...tm/frlrfIBMDataDB2DB2ConnectionClassTopic.htm
 
F

Frans Bouma [C# MVP]

C.E.O. Gargantua said:
I am using the IBM DB2 Connector class of the Redistributable DB2
Run-Time Client Lite in a c# .net application using Visual Studio.

Running the code:

string myConnString = "DATABASE=192.168.1.43;UID=XXXX;PWD=XXXX";

this isn't correct.
Use something like:
"Database=SAMPLE;Server=192.168.1.43;UID=XXXX;PWD=YYYY;"
or with portnumber:
"Database=SAMPLE;Server=192.168.1.43:1533;UID=XXXX;PWD=YYYY;"

At least that's how I construct the connection strings, which do work.
I had similar issues like the ones you describe. Also if usernames
apparently don't match you get this kind of error.

Frans.
--
 
C

C.E.O. Gargantua

I will try that!

However, what is DATABASE?

I am new to the iSeries and I am familiar with the $Library.File.Member
syntax but not "Database".
 
F

Frans Bouma [C# MVP]

C.E.O. Gargantua said:
I will try that!

However, what is DATABASE?

I am new to the iSeries and I am familiar with the $Library.File.Member
syntax but not "Database".

DB2 works with catalogs, in which you have schemas in which you have
tables, similar to SqlServer. With 'Database' you specify which catalog
to connect to, which has to be present in the DB2 instance running on
the server you specify with 'server' :)

AS/400's present themselves as a different system, you are INSIDE Db2
or inside a 4GL on top of DB2, but never see DB2 itself. From the
outside however you can use it as a db2 instance as it is, in fact, a
db2 instance running on the OS :)

FB
Frans Bouma [C# MVP] wrote:

this isn't correct.
Use something like:
"Database=SAMPLE;Server=192.168.1.43;UID=XXXX;PWD=YYYY;"
or with portnumber:
"Database=SAMPLE;Server=192.168.1.43:1533;UID=XXXX;PWD=YYYY;"

At least that's how I construct the connection strings, which do work.
I had similar issues like the ones you describe. Also if usernames
apparently don't match you get this kind of error.

Frans.


--
 
T

The God's Awful Truth

I now see a new class of error. Are there additonal parameters I should
use in my Connection String? I am still not sure what a Database
is...MARDRPALL is a File in the $HAWLIB. Should I use the Library name?

Using the connection string:

try {

string myConnString =
"Database=MARDRPALL;Server=192.168.1.43;UID=JBAILO;PWD=TOOTHPICK1;";

DB2Connection myConnection =
new DB2Connection(myConnString);

myConnection.Open();

} catch (Exception e) {Debug.WriteLine(e.ToString());}


The error is:

IBM.Data.DB2.DB2Exception: ERROR [HY009] [IBM] CLI0124E Invalid
argument value. SQLSTATE=HY009
at IBM.Data.DB2.d.a(String A_0, Int32 A_1, IsolationLevel A_2,
DB2Connection A_3)
at IBM.Data.DB2.DB2ConnPool.a(DB2Connection A_0, String A_1, a& A_2,
Object& A_3)
at IBM.Data.DB2.DB2Connection.Open()
at dot400.Form1.processSqlRequest(String qs, Int32 q) in
c:\documents and settings\jbailo\my documents\visual studio
projects\dot400\form1.cs:line 205

If I use Database=Sample, or Database=$HAWLIB, the error is:

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

at IBM.Data.DB2.d.a(String A_0, Int32 A_1, IsolationLevel A_2,
DB2Connection A_3)
at IBM.Data.DB2.DB2ConnPool.a(DB2Connection A_0, String A_1, a& A_2,
Object& A_3)
at IBM.Data.DB2.DB2Connection.Open()
at dot400.Form1.processSqlRequest(String qs, Int32 q) in
c:\documents and settings\jbailo\my documents\visual studio
projects\dot400\form1.cs:line 205

So it seems like MARDRPALL is a database...

this isn't correct.
Use something like:
"Database=SAMPLE;Server=192.168.1.43;UID=XXXX;PWD=YYYY;"
or with portnumber:
"Database=SAMPLE;Server=192.168.1.43:1533;UID=XXXX;PWD=YYYY;"

At least that's how I construct the connection strings, which do
work. I had similar issues like the ones you describe. Also if usernames
apparently don't match you get this kind of error.

Frans.


--
incognito...updated almost daily
http://kentpsychedelic.blogspot.com

Texeme Textcasting Technology
http://texeme.com
 
F

Frans Bouma [C# MVP]

The said:
I now see a new class of error. Are there additonal parameters I should
use in my Connection String? I am still not sure what a Database
is...MARDRPALL is a File in the $HAWLIB. Should I use the Library name?

I'm not sure, but what I do know is that with an AS/400 you get DB2
client software, with which you can administrate the DB2 instance on the
AS/400. With that one you could browse teh DB2 instance and see which
catalogs there are..
Using the connection string:

try {

string myConnString =
"Database=MARDRPALL;Server=192.168.1.43;UID=JBAILO;PWD=TOOTHPICK1;";

Your AS/400 is on TCP/IP or does it use IBM net? Also, did you try the
local dns name for 192.168.1.43?

Frans.

--
 
C

C.E.O. Gargantua

Ok, so someone told me that the whole machine is a database, so I used
this connection string:

string myConnString =
"Database=as400;Server=192.168.1.43;UID=JBAILO;PWD=TOOTHPICK1;";

That generated a new error which seems to indicate a problem with the
protocol specification...

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

I wonder if I need to specify tcp/ip. I tried using the Net
Library=TCPIP but it threw an Invalid argument.
 
F

Frans Bouma [C# MVP]

C.E.O. Gargantua said:
Ok, so someone told me that the whole machine is a database, so I used
this connection string:

yes, because on an AS/400 you work inside the DB2 instance (not
entirely true, but lets say you do for simplicity).

However, what you did is not correct. Btw, The DB2 UDB .net provider
works with AS/400 if DB Connect is installed on the AS/400. Is that the
case?

Frans.
string myConnString =
"Database=as400;Server=192.168.1.43;UID=JBAILO;PWD=TOOTHPICK1;";

That generated a new error which seems to indicate a problem with the
protocol specification...

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

I wonder if I need to specify tcp/ip. I tried using the Net
Library=TCPIP but it threw an Invalid argument.


I'm not sure, but what I do know is that with an AS/400 you get
DB2 client software, with which you can administrate the DB2 instance
on the AS/400. With that one you could browse teh DB2 instance and see
which catalogs there are..




Your AS/400 is on TCP/IP or does it use IBM net? Also, did you try
the local dns name for 192.168.1.43?

Frans.


--
 
C

C.E.O. Gargantua

Frans said:
However, what you did is not correct. Btw, The DB2 UDB .net provider
works with AS/400 if DB Connect is installed on the AS/400. Is that the
case?

How can I confirm whether it's installed or not? What command?

I have been able to use OleDb to connect...does this imply that DB
Connect is installed ?









Frans.
string myConnString =
"Database=as400;Server=192.168.1.43;UID=JBAILO;PWD=TOOTHPICK1;";
That generated a new error which seems to indicate a
problem with the protocol specification...

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

I wonder if I need to specify tcp/ip. I tried using the Net
Library=TCPIP but it threw an Invalid argument.


The God's Awful Truth wrote:

I now see a new class of error. Are there additonal parameters I
should use in my Connection String? I am still not sure what a
Database is...MARDRPALL is a File in the $HAWLIB. Should I use the
Library name?




I'm not sure, but what I do know is that with an AS/400 you get
DB2 client software, with which you can administrate the DB2 instance
on the AS/400. With that one you could browse teh DB2 instance and
see which catalogs there are..

Using the connection string:

try {

string myConnString =
"Database=MARDRPALL;Server=192.168.1.43;UID=JBAILO;PWD=TOOTHPICK1;";




Your AS/400 is on TCP/IP or does it use IBM net? Also, did you
try the local dns name for 192.168.1.43?

Frans.


--
Texeme
http://texeme.com

incognito () Updated Almost Daily
http://kentpsychedelic.blogspot.com
 

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