FairCom c-tree ODBC Connection - PHP

800 views Asked by At

I have a User DSN configured in Windows ODBC:

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();
}

I always get this error:

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

Wondering what's the correct way to connect to that database in PHP. Thanks!

1

There are 1 answers

0
Xin Chen On

Worked it out.

PHP can't connect to a User DSN, it needs to be System DSN.

Also, Windows ODBC Manager by default is 64 version, needs to launch 32 version to configure the System DSN.

Hope this helps someone.