I'm trying to connect to a remote pervasive database from a php script using a dsn-less ODBC connection. It works when I use a DSN, but not when I try a dsn-less connection. Here's the connection string I'm trying:
$dsn2 = "DRIVER={Pervasive ODBC Client Interface};ServerName=jsoft.ca:1583;ServerDSN=DEMO ";
echo $thetable;
$connect = odbc_connect($dsn2, "", ""); // connect to DEMO database no userid or password
$query = "SELECT * from $thetable"; // set the query variable to contain the SQL you want to execute
$result = odbc_exec($connect, $query); // perform the query
// print out the entire resultset as HTML table (uncomment following line)
// odbc_result_all($result);
... And here's the error I'm getting:
Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /var/www/pvswsample1_ODBC.php on line 63
If I use a DSN it works. Here's the string and odbc.ini for that:
$connect = odbc_connect("REMOTE_DEMO", "", ""); // connect to DEMODATA database no userid or password
odbc.ini:
[ODBC Data Sources]
REMOTE_DEMO=Pervasive ODBC Client Interface
[REMOTE_DEMO]
Driver=/usr/local/psql/lib/odbcci.so
Description=Pervasive ODBC Client Interface: jsoft.ca:1583/DEMO
ServerDSN=DEMO
ServerName=jsoft.ca:1583
UID=
PWD=
Any help would be greatly appreciated