Gremory Posted May 4, 2010 Share Posted May 4, 2010 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 Quote Link to comment Share on other sites More sharing options...
Gremory Posted May 5, 2010 Author Share Posted May 5, 2010 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.