我在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中连接到该数据库的正确方法是什么。谢谢!
算出来了。
PHP无法连接到User DSN,它需要连接到System DSN。
另外,Windows ODBC管理器默认是64版本,需要启动32版本来配置System DSN。
希望这能帮助到别人。