From: Nicola S. <co...@wo...> - 2005-11-04 11:57:14
|
Hi all, I have made a web application with PHP that retrieves data from a Microsoft Access MDB file stored on a Linux hosting provider. The problem is that I get this error message when I try to connect to the MDB database: Warning: odbc_connect(): SQL error: , SQL state in SQLConnect in ... at line ... As you can see there is not a SQL state code. Sometimes the code appears as a sequence of unreadable special characters. What do I do wrong? The configuration is the following one. The hosting provider have installed these softwares: - PHP / Apache - UnixODBC 2.2.11 - MDBTools 0.6pre1 I found this tutorial very useful http://bryanmills.net:8086/archives/000099.html Following the suggestions I have created the .odbc.ini file on my user root folder with the command odbcinst -i -s -f odbc.ini where odbc.ini file template is [TempMDB] Description = Microsoft Access Database Driver = /usr/local/lib/libmdbodbc.so.0 Database = /usr/local/psa/home/vhosts/myaccount.com/path/file.mdb Servername = localhost port = 9875 The hosting has assigned the port 9875 to my account. As you can see I have put the path driver because I could not create the odbcinst.ini (I do not have write permission in the /etc directory). This is the simple PHP code I wrote to connect to the MDB database <?php putenv("ODBCINI=/usr/local/psa/home/vhosts/myaccount.com/.odbc.ini"); $myDB = odbc_connect("TempMDB","",""); ?> If I execute that code I got the error message I wrote at the beginning of this post. Is there someone that can help me? Thank you. -- Nicola |