zflight Posted May 9, 2010 Posted May 9, 2010 I am having trouble connecting to a Microsoft Access Database. This is the code that is on my php page: $db=odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=database.mdb; SystemDB=security.mdw;","user","pass"); And this is the error that I am getting: 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 **path**/default.php on line 16 I don't know that much about connecting because it has always worked on my test environments. From the looks of it to me the driver isn't there to connect to the database. Does anyone else have any suggestions as to how I might get this working? If any other information is needed to troubleshoot, please ask and I will do my best to answer. Any help greatly appreciated!!
Wizard Posted May 9, 2010 Posted May 9, 2010 This support request is being escalated to our root admin.
Ashoat Posted May 9, 2010 Posted May 9, 2010 We don't have a driver for Access. If you can provide a free one, please let us know and we'll install it.
zflight Posted May 10, 2010 Author Posted May 10, 2010 Well that stinks... Thanks for the information, and I will definitely look for one that can be used. I don't exactly know what I'm looking for, but as much as I use Access databases in my webpages, I guess I should look. Thanks for the reply! We don't have a driver for Access. If you can provide a free one, please let us know and we'll install it. There is one that Microsoft offers for free, but it is for the Windows Server 2003 and 2008 operating systems. I don't know what the server (stevie) is running for an operating system. Could you reply or PM me what the operating system is so that I can look and see what I can find. I don't mind looking and seeing what I can find and hopefully this will help others out down the road that want to use Access as well.
Ashoat Posted May 10, 2010 Posted May 10, 2010 Our OS information should be in your cPanel, but we're running CentOS 5.4 x64_86. We're using unixODBC as our ODBC driver, so specific ODBC database drivers will need to be compatible with it.
zflight Posted May 11, 2010 Author Posted May 11, 2010 Our OS information should be in your cPanel, but we're running CentOS 5.4 x64_86. We're using unixODBC as our ODBC driver, so specific ODBC database drivers will need to be compatible with it. I see what you mean about looking for a free driver. I did a little research and found one for about $700. HA! I found something for free on sourceforge.net. It is called MDB Tools. I looked and it said that it is for the Linux operating system. There is also a forum post on how to make it work with unixODBC driver. I can attach the link to that if you want that specifically. This is the link for MDB Tools: http://sourceforge.net/projects/mdbtools/ I don't know how much it would take for this to work, but this might work as a free something that can be added on to the service. Hope it works... Thanks!
Ashoat Posted May 11, 2010 Posted May 11, 2010 Can you add the link for making it work with unixODBC?
zflight Posted May 12, 2010 Author Posted May 12, 2010 Can you add the link for making it work with unixODBC? This is the link: http://sourceforge.net/projects/mdbtools/f...9/topic/3593107 (there is a link within that page as well) Now I know how to make webpages and know a good amount of code, but I have never worked with Linux, so if this isn't what you need, let me know and I can look further into it. Thanks again!
Ashoat Posted May 12, 2010 Posted May 12, 2010 I'm getting the following error when I try compiling --with-unixodbc: backend.c:31: error: static declaration of 'mdb_backends' follows non-static declaration ../../include/mdbtools.h:150: error: previous declaration of 'mdb_backends' was here
zflight Posted May 12, 2010 Author Posted May 12, 2010 I'm getting the following error when I try compiling --with-unixodbc: Well I'll go start googling that and see what I can find. I'll let you know what I come up with. Thanks.
zflight Posted May 12, 2010 Author Posted May 12, 2010 djbob, I think I found what the problem is. It appears that there are two lines of code that use mdb_backends that should be the same, except they aren't. I found a few sites that explain how to fix it, but the best and easiest one I copied the text below. Link: http://sourceforge.net/tracker/?func=detai...p;group_id=2294 backend.c:31: error: static declaration of 'mdb_backends' follows non-static declaration ../../include/mdbtools.h:150: error: previous declaration of 'mdb_backends' was here mdb_backends has different declarations. In file include/mdbtools.h: extern GHashTable *mdb_backends; In file src/libmdb/backend.c: static GHashTable *mdb_backends; That one explains it best. Basically you need to find the line of code that says "extern ..." and change it to "static ...". I thought they said that the problem was fixed, but maybe it was just noted. I am keeping my fingers crossed that that will fix the problem, but if it doesn't let me know and I'll dig a little deeper.
Ashoat Posted May 12, 2010 Posted May 12, 2010 Okay, after that I was able to configure, build, and install the package successfully. I added an entry to the odbcinst.ini file under the name "MDB" (I think you'll need that in your connection string). Let me know if it's working.
zflight Posted May 12, 2010 Author Posted May 12, 2010 Okay, after that I was able to configure, build, and install the package successfully. I added an entry to the odbcinst.ini file under the name "MDB" (I think you'll need that in your connection string). Let me know if it's working. I am still getting the same error message. I am trying changing the driver to different things and it still isn't working. I tried: $db=odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=database.mdb; SystemDB=security.mdw;","user","pass"); $db=odbc_connect("Driver={MDB (*.mdb)};Dbq=database.mdb; SystemDB=security.mdw;","user","pass"); $db=odbc_connect("Driver={MDB};Dbq=database.mdb; SystemDB=security.mdw;","user","pass"); and a few other little variations. I'll google and see what I can come up with, but if you have any ideas, they would be greatly appreciated. Thanks!
zflight Posted May 12, 2010 Author Posted May 12, 2010 What's the error message you are getting? 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 /**path**/test.php on line 6 The page is: www.zflight.heliohost.org/flightslandscaping/test.php
Recommended Posts