ODBC连接字符串格式,而不是查找文件 [英] Odbc connection string format, not finding files

查看:165
本文介绍了ODBC连接字符串格式,而不是查找文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是那种可能有一个单一的答案双重问题。

This is kind of a 'double' question that might have a single answer.

我用的AS / 400的ODBC连接的工作,我的连接字符串如下:

I'm working with an Odbc Connection with an AS/400, with my connection string as follows:

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

我能够连接到系统的罚款。

I'm able to connect to the system fine.

* USRLIBL包含用户(这是类型为仅API它可以访问到所有用户库)所有必要的库文件。

*USRLIBL contains all the necessary libraries from the user (which is of the type 'API only' which has access to all user libraries).

然而,当我尝试访问某些ERP库,它说,他们无法找到,而其他的可以。

However, when I try to access certain ERP libraries, it says they can't be found, while other ones can.

因此​​,作为一个非常基本的演练:

So as an extremely basic walkthrough:

1. Open Connection - Query File 1 from Library A:  OK! - Close Connection
2. Open Connection - Query File 2 from Library A:  OK! - Close Connection
3. Open Connection - Query File 1 from Library B:  Exception  SQL0204 - in UserName type *FILE not found 

好了,我在ERP的文件将在特定的库增加,使得连接字符串如下,只是为了测试程序:

Ok, so I added in the specific library that the ERP files would be in, making the connection string as follows, just to test the program:

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

但后来我开始变得不同的问题(另一种非常基本的演练)

But then I start getting a different problem (another extremely basic walkthrough)

1. Open Connection - Query File 1 from Library A:  OK! - Close Connection
2. Open Connection - Query File 2 from Library A:  OK! - Close Connection
3. Open Connection - Query File 1 from Library B:  OK! - Close Connection
4. Open Connection - Query File 1 from Library A again:  Exception SQL0202 - in LibraryB type *FILE not found.  

所以我的问题(S)是:

So my question(s) are:

为什么不ODBC的ConnectionString DefaultLibraries = * USRLIBL不会返回正确的库? (注:我还测试了这款采用这实际上工作得很好......但是,iDB2Connection不能部署,因为它从字面上崩溃服务器的iDB2Connection)

Why doesn't the odbc connectionstring DefaultLibraries=*USRLIBL not return the correct libraries? (Note: I also tested this using an iDB2Connection which in fact works fine... however, the iDB2Connection can not be deployed as it literally crashes the server)

为什么第二次演练中抛出一个异常,它只是似乎从LibraryB阅读甚至一度后'跳过'* USRLIBL。

Why does the second walkthrough throw an exception, it just seems to 'skip past' *USRLIBL after reading from LibraryB even once.

有什么想法?

开始编辑:

实际上有两个用户,DEV和PROD

There are actually two users, DEV and PROD

中的* USRLIBL会从环境本身所需的所有库,因此,如果打开连接时,它检测到本地主机环境,或者任何的不安全(加上其他一些注意事项),则默认为DEV登录凭据的创建连接之前的。这就是为什么系统,UID和PWD在连接被指定为参数(而不仅仅是计算器I-不要-想对给出的数据占位符)

The *USRLIBL gets all the necessary Libraries from the Environment itself, so if when opening the connection, it detects a localhost environment, or anything that's unsecure (plus a few other caveats), it defaults to DEV log in credentials before creating the connection. This is why the system, uid, and pwd are designated as parameters in the connection (and not just stackoverflow I-dont-want-to-give-out-data placeholders)

中的* USRLIBL然后再换从API用户所需的库。

The *USRLIBL then pulls the necessary libraries from the API user.

要澄清一下,它的设置方式不使用iDB2连接器的工作,但由于我们的ERP系统的局限性(我们认为),用它与IIS 7的服务器会导致灾难性的失败,所以我们正在使用在ODBC连接器。

To Clarify, the way it's set up does work using the iDB2 Connector, but because of the limitations of our ERP system (we think), using it with an IIS 7 server causes a catastrophic failure, so we're working with the ODBC connector.

结束编辑:

推荐答案

您可以限定你的表名作为library.filename,而不必处理任何库列表中的问题。

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

有关详细信息:

客户端访问ODBC:默认库设置

ODBC连接字符串关键字

相关部分的摘要是:

使用SQL命名约定,操作系统不执行库列表搜索来查找不合格的对象。如果默认定义集合,默认集合用于解析不合格的SQL语句。

...

使用SYS命名约定,不合格的SQL语句去默认集合。如果没有缺省集合,则使用当前库。如果没有指定当前库,则使用库列表。

...

默认集合

任务属性通过ODBC决定处理包含限定SQL名的SQL语句时使用的库设置。当默认集合设置的所有不合格的对象,除了过程,函数和类型必须驻留在缺省集合,不管命名约定。

...

我怎样才能得到ODBC搜索库列表?

如上所述,编辑ODBC数据源,并设置系统命名为SYS。默认的库必须是空的,或者在旧版本比R510,默认库设置必须用逗号开始,这样没有默认定义集合(例如,MYLIB1,MYLIB2)。

试试这个连接字符串,使系统命名,并没有设置一个默认的库:

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

=驱动i系列{访问ODBC驱动程序};系统= {0}; UID = {1}; PWD = {2};命名= 1; DefaultLibraries =,* USRLIBL,LibraryB;

这篇关于ODBC连接字符串格式,而不是查找文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆