Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unixODBC & mdbTolls & PHP help

Status
Not open for further replies.

cmancre

Programmer
Jan 30, 2005
35
PT
Im trying to run an mdb file under linux
I've installed unixODBC, mdbTools, apache and php

configurations:

odbcinst.ini :

[MDBToolsODBC]
Description = MDB Tools ODBC drivers
Driver = /usr/lib/libmdbodbc.so.0
Setup =
FileUsage = 1
CPTimeout =
CPReuse =

odbc.ini :

[Dogs]
Description = Microsoft Access Database
Driver = MDBToolsODBC
Database = /root/pmpquota.mdb
Servername = 127.0.0.1
Username =
Password =
port = 5432

test.php :
<?php
$myDB = odbc_connect("Dogs","","");
?>

when i load the test.php i get this erros:

odbc_connect(): SQL error: ,?, SQL state 00000 in SQLConnect

i did run phpinfo() and php supports unixodbc

I need some HELP!!!!!!
 
AFAIK, access will not run on linux...

Bastien

Cat, the other other white meat
 
Though Access won't run under Linux you CAN use Access databses (mdb) with mdbtools. I've been able to successfully use gMDB2 to query MDBs using the mdbtools odbc driver. I'm also working on getting PHP to access MDBs via unixODBC. It can be done, so don't give up on it. There is one limitation that you should be aware of. The mdbtools driver only allows read-only access to the MDB. If I have any more success with it, I'll post it.
 
I managed to get it working running PHP from a shell, but it doesn't seem to work properly when accessing the PHP script from Apache.

I'm using Fedora Core 3, so you're results may differ.
The odbc.ini file in /etc was not being referenced by unixODBC. I had to make a symbolic link from ~/.odbc.ini to /etc/odbc.ini. Then it would work properly. (You would assume that if the DSN is not found in the user's odbc.ini that it would check to global one, but that doesn't seem to be the case) Also be sure that /usr/lib/libmdbodbc.so.0 is a link to /usr/lib/libmdbodbc.so.0.0.0 (it may also be /usr/local/lib depending on your installation). Otherwise, your config looks good. You may want to try running "isql -v Dogs" to see if you can even access your data source.

Assuming that everything is installed correctly, it should work with those few tweaks. BTW: If you're trying to use an Access 2000/XP database, you may get some flacky results when doing queries with the mdbtools driver (especially with long table names and selective queries). However, Access 97 databases seem to work fine.

I've got a hunch as to why its not working properly under Apache, but I have yet to try anything. If I have any successful results, I'll post them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top