All 32Bit. Windows 2018 Server. PVSQL v10 (I can't update this)
PHP 5.3.28 (I might be able update this to 5.6.x) 7.x Would break too much
I've tried searching everywhere for an example on how to connect PHP to Pervasive DB with PDO. I've managed to connect using the following non PDO connector:
$conn = odbc_connect("demodata","","");
if(!$conn) die("Could not connect");
Looking at the examples from https://docs.actian.com/psql/psqlv13/index.html#page/odbc%2Fodbcadm.htm%23ww1213912 I found that I should be using something like:
try {
$conn = new PDO("odbc:Driver={Pervasive ODBC Client Interface};ServerDSN=demodata;");
if(!$conn) die("Could not connect");
}
catch (PDOException $e) {
echo $e->getMessage();
exit;
}
I also tried:
$conn = new PDO("odbc:Driver={Pervasive ODBC Client Interface};ServerName=localhost;SeverDSN=demodata;");
$conn = new PDO("odbc:Driver={Pervasive ODBC Client Interface};ServerName=localhost;SeverDSN=DEMODATA;");
When I do though. I get the error:
SQLSTATE[HY000] SQLDriverConnect: -1206 [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface][Data Record Manager]Non-db file or corrupted db.
But I know its not corrupted.I'm able to connect and do queries the other way. Would just really like to be able to use PDO. When I do a test from the Pervasive ODBC Client DSN Setup. I get Connection Successful.
What am I missing?