Menu

DSNless iODBC with PHP and MS Access

Help
2005-08-18
2013-05-08
  • earthsprite380

    earthsprite380 - 2005-08-18

    It looks like this forum has been abandoned...  I hope there is someone listening.

    I'm having trouble connecting to a database using ODBC via a DSN less connection on a linux machine (so technically using iODBC).  It's for a website - I'm coding in PHP, my database is MS Access.

    I have found resources telling me how to set up a DSNless connection if I'm on a windows machine - when I have a path like "C:/whatever/mydatabase" but not if I have a path such as "/mnt/home/me/mydatabase".  Actually I'm not sure if it's the path that is the problem, or the way the DSN is set up (or defined/not defined)...

    I can connect on my windows machine fine (I'm running apache thru win - using xampp).  My connection string:
    Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/me/data/mydata.mdb

    On my host (linux running apache, php 4.3.11), I get an error:
    Warning: odbc_connect(): SQL error: [iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded, SQL state IM002 in SQLConnect

    My connection string looks like:
    Driver={Microsoft Access Driver (*.mdb)};DBQ=/mnt/home/me/data/mydata.mdb

    From what I can gather, I think I need to create an odbc.ini file in which I specify the DSN (Data Source Name), then in my code I setenv ODBCINI to $HOME/odbc.ini (where $HOME is /mnt/home/me).  But I don't know what to put in this odbc.ini file.  I don't even know if that is the problem here. 

    I've never done this for a path that was not mapped to an actual drive name (D:/inetpubs/whatever vs /mnt/whatever), so I'm not sure if that's the problem, or if I am not doing something else correctly.

    Any and all help is greatly appreciated.  Thank you!

    Lauren

     
    • Tathagata

      Tathagata - 2006-08-18

      I guess you **at least** need a MSAccess odbc driver on the linux box.
      Even if you have a driver, from the things i understand, this kind of thing is not possible from unix->windows unless you have samba, because msaccess doesnt provide a db service, the client library manipulates the mdb file on its own, so we need access to the file, which can be done through samba.
      One thing you can try.. Multi-tier drivers... Openlink/Easysoft should have them.
      Hope that helps.

       

Log in to post a comment.