简体   繁体   English

PHP ODBC_connect与现有的ODBC驱动程序

[英]PHP ODBC_connect with existing ODBC drivers

I have an ODBC Connection that works: 我有一个有效的ODBC连接:

$cqmconn = odbc_connect("Driver={SQL Server Native Client 10.0};
Server=JOHN-HP;
Database=cqmla;", "sa", "sa") or die ("Unable to connect to CQM site.");

However, I have an existing ODBC Driver called "cqm2" that connects to cqmla, but the line beow does NOT make a connection: 但是,我有一个现有的ODBC驱动程序,名为“ cqm2”,它连接到cqmla,但是行号不建立连接:

$cqmconn = odbc_connect("cqm2","sa","sa") or die ("Unable to connect to CQM site.");

I can, however, use that ODBC connection (and credentials) with other software and it works fine. 但是,我可以将该ODBC连接(和凭据)与其他软件一起使用,并且工作正常。 What am I missing? 我想念什么?

I ask this because while I certainly can use the first method here, I have ANOTHER proprietary system that I cannot get to work, although it does have an ODBC connection I can access via other software using the: $cqmconn = odbc_connect("cqm2","sa","sa") format. 我之所以这样问,是因为虽然我当然可以在这里使用第一种方法,但我有一个无法运行的另一个专有系统,尽管它确实具有ODBC连接,但我可以使用以下软件通过其他软件访问: $cqmconn = odbc_connect("cqm2","sa","sa")格式。 If I can get my existing connection to work here, I figure I should then be able to call the other one. 如果我可以在这里使用我现有的连接,我想我应该可以再呼叫另一个。

What am I missing? 我想念什么?

PS: I've tried adding SQL_CUR_USE_ODBC to the end of the call, but it changed nothing. PS:我已经尝试将SQL_CUR_USE_ODBC添加到调用的末尾,但是它什么都没有改变。

Answering my own question: It seems that odbc_connect() for PHP does NOT recognize User DSNs, only System DSNs. 回答我自己的问题: PHP的odbc_connect()似乎不能识别用户DSN,而只能识别系统DSN。 As a result, when I changed the DSN I was trying to use for a connection to a System DSN, I was able to use the: $cqmconn = odbc_connect("cqm2","sa","sa") paradigm. 结果,当我更改要用于与系统DSN的连接的DSN时,可以使用: $cqmconn = odbc_connect("cqm2","sa","sa")范式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM