By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,779 Members | 1,101 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,779 IT Pros & Developers. It's quick & easy.

Invalid arg exception when connecting to db w/underscore in name

P: n/a
I am using DB2 Connect 8.2 to DB2 on z/OS. I've used Config. Assistant
to create the config to the mainframe DB2 database (Location) called
DB_MAIN. I can successfully test the connection w/this tool

I am not able to access the db on the mainframe through ADO.NET. My
code looks like this:
string connStr =
"server=bigblue;UID=username;pwd=password;database =DB_MAIN;";
DB2Command c1 = new DB2Command("select ColA from tableA;");
c1.Connection = new DB2Connection(connStr);

When this code executes, the following exception occurs:
IBM.Data.DB2.DB2Exception: ERROR [08004] [IBM] SQL30061N The database
alias or database name "DB_MAIN " was not found at the remote
node. SQLSTATE=08004

I refactored the code to use ODBC to use the System DSN created by
Config. Assistant. The code looks like this:
// DSN DB_MAIN maps to DB_MAIN db (Location) on mainframe
string connStr = "DSN=DB_MAIN;UID=username;pwd=password;";
OdbcCommand c1 = new OdbcCommand("select ColA from tableA;");
c1.Connection = new OdbcConnection(connStr);

OdbcDataReader r = c1.ExecuteReader();
// process reader

The connection works, the command executes and the reader works in the
ODBC case.

I believe the problem using the .NET provider is due to the underscore
in the connect string's database name. I've tried escaping it with /,
but that doesn't help.

Has anyone else run into this problem? How can I get it to recognize
the name correctly?

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply

P: 1
This happens with Federated Databases when the name is not properly entered in SysCat.
Jul 25 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.