I am trying to link to a 3rd party paradox database and have adapted some MS SQL ODBC code. The paradox database is called IB01.db:
But I get the error:
Warning: odbc_do(): SQL error: [Microsoft][ODBC Paradox Driver] The Microsoft Jet database engine could not find the object 'IB01.DB'. Make sure the object exists and that you spell its name and the path name correctly., SQL state S0002 in SQLExecDirect in E:\WASP\scripts\files.inc.php on line 225
Error executing query SELECT ClientCode, ReportName FROM IB01.DB
I think this could be my query, as I had other errors originally which I have solved. Any help?
Code:
function GetODBCLink()
{
$i = 0;
$files = "";
// odbc_query.php
$odbc_dsn = "sagedata_paradox";
$odbc_userid = "";
$odbc_password = "9PL";
//$query = "SELECT IB01.ClientCode, IB01.ReportName FROM IB01.DB WHERE IB01.ClientCode Not Like 'ZZ%' ORDER BY IB01.ClientCode";
$query = "SELECT ClientCode, ReportName FROM IB01.DB";
if(!($odbc_db = odbc_connect($odbc_dsn, $odbc_userid, $odbc_password)))
die ("Could not connect ot ODBC data source $odbc_dsn");
if(!($odbc_rs = odbc_do($odbc_db, $query)))
die("Error executing query $query");
$num_cols = odbc_num_fields($odbc_rs);
if($num_cols < 1) die("Query returned an empty set");
while(odbc_fetch_row($odbc_rs))
{
// $files[$i] = array('ClientKey' => odbc_result($odbc_rs,'ClientKey'),'CoyName' => odbc_result($odbc_rs,'CoyName'));
// $files[$i] = odbc_result($odbc_rs,'ClientKey');
$files[$i] = odbc_result($odbc_rs,'ClientCode') . " | " . odbc_result($odbc_rs,'ReportName');
$i++;
}
return $files;
}
But I get the error:
Warning: odbc_do(): SQL error: [Microsoft][ODBC Paradox Driver] The Microsoft Jet database engine could not find the object 'IB01.DB'. Make sure the object exists and that you spell its name and the path name correctly., SQL state S0002 in SQLExecDirect in E:\WASP\scripts\files.inc.php on line 225
Error executing query SELECT ClientCode, ReportName FROM IB01.DB
I think this could be my query, as I had other errors originally which I have solved. Any help?