Dot Net Fluke: Getting by on C# for iSeries RPG Developers

Useful tutorials on C# and .NET for RPG iSeries AS/400 developers. Brought to you from the folks at AranRock Consulting

9/22/08

Connection String Stinger - Phantom Library List

.Net can look for your tables in a library the same name as your user id  even if you supply a library list. This can cause your SQL 'selects' to fail.

Take a look:
Here's a basic connection string using the IBM supplied iDB2 Classes:

DataSource=192.168.0.1; UserID=colm;Password=xxxx;LibraryList= CusLib,ARlib, QGPL

At first glance everything looks good, right?

So now I want to get at my table MYCUST in CusLib. Should be a no brainer. However if I run the SQL command 'Select * from MYCUST' guess what I get?  - A big fat error like this:

SQL0204 - File MYCSUT in COLM not found

What??. CusLib is on the TOP - I don't even mention library Colm.  What's going on?

IBM says that if you are using the SQL naming convention that it sets the default collection or library to the library with the same name as the user id. I have no idea why they do this! Anyway if you have this issue the simple fix is to specify the default collection. i.e. defaultcollection=cuslib

Here's the new connection string

DataSource=192.168.0.1; UserID=colm;Password=xxxx;LibraryList= CusLib,ARlib, QGPL;DefaultCollection=CUSLIB

Labels: , , ,

2 Comments:

At November 13, 2008 2:40 PM , Blogger miathet said...

I searched you posts and they are useful. Have done or seen anything about .Net and Data Queues on the iSeries?

 
At December 18, 2008 7:29 PM , Blogger MA Shumin (馬淑敏) said...

Trying to get in touch with a certain Colm Bryne I worked with in San Francisco, summer 2000.

 

Post a Comment

<< Home