I'm trying to connect via ODBC to Sage from PHP and I keep getting this error:
Uncaught PDOException: SQLSTATE[S0000] SQLDriverConnect: 145 [ProvideX][ODBC Driver][PVKIO]Logon failed in X
I made a 64 bit DSN, configured it, went to Debug tab, Test Connection, and it works there. This is the connection string from the DSN in Windows.
DSN=MASABC64; UID=ksync2; PWD=abcdef1234; Directory=\\sageserver\sage100\MAS90; Prefix=\\sageserver\sage100\MAS90\SY\, \\sageserver\sage100\MAS90\==\; ViewDLL=\\sageserver\sage100\MAS90\HOME; Company=ABC; LogFile=\PVXODBC.LOG; CacheSize=4; DirtyReads=1; BurstMode=1; StripTrailingSpaces=1; SILENT=1; SERVER=NotTheServer
When I try to incorporate it into my code is when I get an error. PHP PDO Is able to see the DSN, because when I misspell it, or give it a 32 bit DSN, it gives me a different error. There is some login issue I can't track down.
I have tried different combinations. putting a blank password with username, no password at all, using odbc:Driver={MAS 90 4.0 ODBC Driver}; instead of odbc:Driver=MASABC64;
Also tried double escaping backslashes, using the UID=name|company trick too
Nothing seems to work. Here is my example code:
$dbh= new PDO('odbc:DSN=MASABC64; UID=ksync2; PWD=abcedf1234; Directory=\\\\sageserver\\sage100\\MAS90; Prefix=\\\\sageserver\\sage100\\MAS90\\SY\\, \\\\sageserver\\sage100\\MAS90\\==\\; ViewDLL=\\\\sageserver\\sage100\\MAS90\\HOME; Company=ABC; LogFile=\\PVXODBC.LOG; CacheSize=4; DirtyReads=1; BurstMode=1; StripTrailingSpaces=1; SERVER=NotTheServer');
$stmt = $dbh->prepare("$query");
$stmt->execute();
while ($row = $stmt->fetch()) {
print_r($row);
}
unset($dbh); unset($stmt);
Is there a way to debug the exact error and maybe output what the driver sees?