Author Topic: Oppening .dbf file with odbc  (Read 2446 times)

0 Members and 1 Guest are viewing this topic.

Offline GremoryTopic starter

  • Irregular
  • Posts: 2
    • View Profile
Oppening .dbf file with odbc
« on: May 04, 2010, 07:32:40 AM »
Hello. I am having problems accessing my dbf files with PHP. I've been searching for a while for a solution, but can't seem to find a working one. Here is my current situation:

I have a CentOS Server, in which I've placed my dbf files.
I can open these with dbase functions, but I'm limited to my queries, since I have thousands of records.
I've been trying something similar to this:



<?php
error_reporting
(E_ALL);
ini_set('display_errors''1');
$data_source 'DRIVER={Microsoft dBASE Driver (*.dbf)};datasource=/home/dir/file.dbf;';
//$data_source = 'DRIVER={Microsoft dBASE Driver (*.dbf)};DriverID=277;datasource=/home/dir/file.dbf;';
$user='';
$password='';
$conn=odbc_connect($data_source,$user,$password);
if (!
$conn)
{
	
exit(
"Connection Failed:" odbc_errormsg() );
}
?>


I get the following error output:
Warning: odbc_connect() [function.odbc-connect]: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /home/dir/index.php on line 45
Connection Failed:[unixODBC][Driver Manager]Data source name not found, and no default driver specified

Offline GremoryTopic starter

  • Irregular
  • Posts: 2
    • View Profile
Re: Oppening .dbf file with odbc
« Reply #1 on: May 05, 2010, 07:03:06 AM »
update:

I've been reading alot, and I noticed I had to install unixODBC, easysoft drivers and freetds to manage my ODBC.
Now, I can't seem to find the right drivers to register in my odbcinst.ini, so that I can use them in the odbc.ini file.

I should be looking for drivers compatible with dBASE right?

Gosh this is getting really troublesome.

I think I'll go with another solution. Since I can't seem to make a query like "select * from table where id = 123" with dBASE, because I have multiple dbf files and need to check all the rows. I might dump all the files into a mysql db. So, everytime I need to update the tables, I just press a button, and I'll update the tables... I think this might be the best solution for my problem, since it is kind of urgent.

I'de like to hear some feedback,
thanks