Odbc connection string format, not finding files

☆樱花仙子☆ 提交于 2019-12-01 20:41:46

You can qualify your table names as library.filename and not have to deal with any library list issues.

For more information:

Client Access ODBC: Default Libraries Setting

ODBC connection string keywords


Excerpts of the relevant parts are:

With SQL naming convention, the operating system does not perform a library list search to locate an unqualified object. If a default collection is defined, the default collection is used to resolve unqualified SQL statements.

...

With the SYS naming convention, the unqualified SQL statements go to the default collection. If there is no default collection, the current library is used. If no current library is specified, the library list is used.

...

Default Collection

A job attribute set by ODBC that determines the library used when processing SQL statements that contain unqualified SQL names. When a default collection is set all unqualified objects except procedures, functions and types must reside in the default collection, regardless of naming convention.

...

How can I get ODBC to search the library list?

As explained above, edit the ODBC data source and set system naming to SYS. The default library must be empty, or on versions older than R510, the default libraries setting must start with a comma so that no default collection is defined (for example, ",MYLIB1, MYLIB2").


Try this connection string to enable system naming and to not set a default library:

driver={iSeries Access ODBC Driver}; system={0}; uid={1}; pwd={2}; naming=1; DefaultLibraries=,*USRLIBL,LibraryB;

user1803525

If anyone runs into this post and is using the IBM.Data.DB2.iSeries .NET data provider as I am, the key point taken from above was using the naming=1 and not specifying a "Default Collection". I was finally successful when using the following portion in my connection string

LibraryList= MyLibrary1,MyLibrary2,MyLibrary3,MyLibrary4;naming=1;

An alternative is to set up a separate user profile for each environment. Since the *USRLIBL is set by the job description, this would entail setting up a separate job description as well. For example:

user: WEB job desc: WEB library list: CUSTPROD, ITEMPROD, UTILITY

user: WEBTEST job desc: WEBTEST library list: CUSTTEST, ITEMTEST, UTILITY

The C# code does not change except for using the test or production user ID to authenticate.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!