Jump to content

Recommended Posts

I am trying to figure out how to query some data out of a dbase IV (.dbf) file sitting on a remote server from my MySQL/PHP/Web Server.

 

Both servers are Windows Server 2003 SP2.

 

My MySQL/PHP/Web server is running PHP 4.3.11, MySQL 4.0.24, and IIS.

 

I have set a system DSN on the remote machine for the directory that contains the dbase file.  The DSN name is SASIxp, and the actual file I'm trying to connect to is ADST.DBF.

 

I've found several examples of how to connect with other database types, and have used those examples in an attempt to connect to my dbase IV file, but so far, I'm not having any luck.  Instead, I'm getting errors like:

 

Warning: odbc_exec(): SQL error: [Microsoft][ODBC dBase Driver] The Microsoft Jet database engine could not find the object 'ADST.DBF'. Make sure the object exists and that you spell its name and the path name correctly., SQL state S0002 in SQLExecDirect in E:\InetPub\wwwroot\posa_test\includes\functions.inc on line 4952

 

I'm including my sandbox code below, which includes 4 different versions of $connection_string, none of which have worked.  :(

 

Does anybody know of a good tutorial, or have any suggestions?  I know I'm somewhat limited in what I can do with a dbase IV file (if anything???), but all I really need is to do a simple lookup;  no adding, deleting or changing of any records.

 

 

//$connection_string = 'DRIVER={Microsoft dBase Driver (*.dbf)};SERVER=<10.112.139.230>;DATABASE=<ADST.DBF>'; 
//$connection_string = 'DRIVER={Microsoft dBase Driver (*.dbf)};SERVER=<10.112.139.230>;DATABASE=<SASIxp>';

//$connection_string = 'DRIVER={Microsoft dBase Driver (*.dbf)};datasource=SASIxp;';
    
$connection_string = 'DRIVER={Microsoft dBase Driver (*.dbf)}; datasource=\\\\sasi_main\\sasixp\\datafile\\ADST.DBF;';
   
    
$user = ''; 
$pass = ''; 
    
//$connection = odbc_connect( $connection_string, $user, $pass ); 
    
$odbc = odbc_connect ($connection_string, '', '') or die('Could Not Connect to ODBC Database!');

$strsql= 'SELECT * FROM ADST.DBF';
  
$query = odbc_exec($odbc, $strsql) or die (odbc_errormsg());

 

Thanks in advance for your assistance!:  :)

Link to comment
https://forums.phpfreaks.com/topic/86208-odbc-connection-to-dbase-iv/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.