Forum Moderators: open

Message Too Old, No Replies

ODBC connection and PHP

Can't connect to mdb database through ODBC

         

caste

3:38 pm on Nov 30, 2005 (gmt 0)

10+ Year Member



Hi there,

I have installed unixODBC, and I think it works properly, here is the result of odbcinst -j command:

unixODBC 2.2.9
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
USER DATA SOURCES..: /root/.odbc.ini

Here is my odbcinst.ini:
[MDBToolsODBC]
Description = MDB Tools ODBC drivers
Driver = /usr/lib/libmdbodbc.so.0
Setup =
FileUsage = 1
CPTimeout =
CPReuse =
UsageCount = 1

Here is my odbc.ini
[Reservas]
Description = Microsoft Access Database of Reservas
Driver = MDBToolsODBC
Database = /home/Comun/reservas.mdb
Servername = localhost
UserName =
Password =
port = 5432

The problem is that I can't connect to the DSN resource through the PHP script when executed through the browser, as if I execute "isql Reservas" from the command line it connects, if I execute "php script.php" from the command line it also works, last two cases work because they are using /root/.odbc.ini which is a symbolyc link to /etc/odbc.ini.

If I type su apache, and I try to execute the php from the command line, it also works, and it uses the /etc/odbc.ini (system related file). But not when connecting through the browser.

I have checked the values of SElinux and I haven't found any configuration option that could be affecting it.

Any ideas?

Thanks,

Caste

caste

1:26 pm on Dec 1, 2005 (gmt 0)

10+ Year Member



Hi there,

I got the solution, it was indeed selinux as I suspected.

I have disabled it temporally with setenforce 0 and it worked.

Caste