IBM .NET Data Provider Connection String issue with Library List

偶尔善良 提交于 2019-12-24 02:25:17

问题


I am trying to use the DB2 .Net Data Provider in a C# program rather than relying on ODBC. The connection string below works, but only for one library (say my libraries are test1 and test2).

Data Source=xxx.xxx.xxx.xxx;User Id=testuser;Password=testpassword;
Naming=SQL;Default Collection=test1;

If I add "Library List=test1, test2;" (I have tried several variations of that) to the connection string, it does not allow me access additional libraries, only what is defined in defaultcollection. I have also tried not specifying default collection as well, but that causes the query to not work at all. What do I need to do to be able to run a query that can access both of these libraries on the same connection?


回答1:


The library list only works when using the system naming convention.

SQL_NAMING
Specifies that tables are qualified by the collection name in the form:

collection.table

where collection is the name of the collection and table is the table name. The default qualifier is the user ID running the process that executes the SQL statement and is used when the table name is not explicitly qualified and the default collection name is not specified.

SYSTEM_NAMING
Specifies that files are qualified by library name in the form:

library / file

where library is the name of the library and file is the table name. The default search path is the library list (*LIBL) for the unqualified table name, if the table name (file) is not explicitly qualified and a default collection name (library) is not specified.




回答2:


With Naming=SQL, if you specify libraries inside your library list, don't need to use Default Collection. Just add something like:

;LibraryList=lib1,lib2,lib3,lib4;SchemaSearchList=lib1,lib2,lib3,lib4;

or to use the default library list on the connection job, which is most likely defined on the user profile.

;LibraryList=*USRLIBL;SchemaSearchList=*USRLIBL;



回答3:


You can follow lamLam answer, I use it for example to change between Test Libraries and Production Libraries.

But check the iSeries SO version. Some older versions don't support the SchemaSearchList. Versions V6R1 and V7R1 support it.



来源:https://stackoverflow.com/questions/19715889/ibm-net-data-provider-connection-string-issue-with-library-list

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