1

我在 Windows ODBC 中配置了一个用户 DSN:

Name      Driver
testdb    FairCom c-tree ODBC Driver

$user = "";
$pass = "";
$dsn  =  "testdb";

$cx = odbc_connect($dsn,$user,$pass);
if($cx === false) {
  echo "<br/>failure<br/><br/>";
  echo odbc_errormsg();
}

我总是收到这个错误:

failure
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

想知道用 PHP 连接到该数据库的正确方法是什么。谢谢!

4

1 回答 1

2

解决了。

PHP 无法连接到用户 DSN,它需要是系统 DSN。

另外,Windows ODBC Manager 默认是 64 版本,需要启动 32 版本来配置系统 DSN。

希望这可以帮助某人。

于 2014-06-21T10:12:28.330 回答