1

At work I have been tasked with building an online form using php that connects to a MS-Access database. Before you guys start mentioning the downsides to using Access online, this solution is for an INTRAnet site and will have minimal traffic, and this database was not created by me and I do not have the option of switching to another less annoying DB option.

Prepping the MS-Access DB (.accdb) for moving online

Based on my research there are very few decent options for actually connecting to a MS-Access database using PHP and I have not been able to find good documentation on how to get this DB, which currently just resides on a shared drive as a .accdb file or something, into a place and form where I can attempt the messy job of connecting to it. At the moment I am not even sure if it is password/username protected. I honestly know nothing about working with MS-Access so any tips you can give me would be great. If it is as simple as converting the .accdb to a .mdb (the file extension I have seen used in my research) and then dropping that into the root directory then great. The only documentation on this I could find so far is "Do not use Access" lol.

Connecting to newly online MS-Access DB with PHP (w/o installing anything on server)

Now I need to connect to this database using PHP. I have found a couple options to do this but my inability to actually access the server (besides our site's root directory) to install libraries/data sources such as ODBC inhibits some of them. If my logic is wrong there and I can run that option by just making changes in the site's directory then great! let me know. Also I have found one instance of someone recoommending adodb.inc.php as an option but the documentation on (http://phplens.com/lens/adodb/docs-adodb.htm#coding) was not super clear as to how to connect or especially how I can interact with it once I do.

Sorry guys, I know this is a lot of stuff but any help is appreciated and as detailed and clear as you can make it would be amazing as I have other projects on my plate right now and not a ton of time to dedicate to R&D on this beyond what I have already spent. Thanks!

Spags
  • 531
  • 5
  • 13
  • 26

3 Answers3

1

I very well may be wrong, but in my experience the only way to connect PHP to an Access database is with ODBC drivers. I don't believe there is a way to make the connection directly.

ams
  • 796
  • 1
  • 12
  • 22
  • Thats what I was worried about. Do you know if it is possible to set up the ODBC stuff in our own site's directory? As I said above I do not have access to the whole server. – Spags Jul 26 '11 at 13:58
  • Most likely not. I don't even know how/if this can be done on a UNIX system, if that's what you're dealing with. I've only ever made this connection on Windows machines, which requires access to the Control Panel's Data Sources component. – ams Jul 26 '11 at 14:01
  • Ah, yeah sorry. Its an IBM HTTP Server (IHS). I do not know exactly what platform it is running on though as those can run on a number of them (AIX, HP-UX, Linux, Solaris, Windows and z/OS) and our IT department is not what I would call helpful. – Spags Jul 26 '11 at 14:15
  • This question did pop up in my sidebar, it may have some direction for you. Good luck! http://stackoverflow.com/questions/1605473/php-and-microsoft-access-database-connection-and-crud – ams Jul 26 '11 at 14:19
  • Could anyone provide a link to some super clear and concise documentation for the ODBC implementation process? If I can convince a higher up that this needs to be installed then I will need to have something that is SUPER simple to have them give IT. If it causes them any trouble they will likely not do it. – Spags Jul 26 '11 at 14:21
0

This is completely outside my area of expertise, as I'm an Access developer and never have to work with Access data files in the environment you're in, but here's what I think:

Given that the Jet/ACE (the database engine for an MDB/ACCDB file) is a file-based database engine, you need SMB network access to the file. HTTP access is not possible.

The easiest thing to do is to put the file on a Windows file server to which the HTTP server has access and then access it via ODBC (which for Jet/ACE is file-based and doesn't require any components running on the file server where the file lives).

As long as the relevant ODBC driver is installed on the HTTP server, you should be OK.

One other thing: if you can use Access 2007/2010 to save the ACCDB as an MDB file, you'll have a lot more flexibility, as most of the ODBC documentation is for Jet 4, not for ACE (the new database engine introduced with A2007 along with the new file format; it's all still Jet, just a new version).

David-W-Fenton
  • 22,871
  • 4
  • 45
  • 58
0

Copnsider using OpenLink Software'sthe Multi-tier ODBC to ODBC Bridge

This product has a client/server architecture like this -

Web Server -- php application OpenLink Generic ODBC Driver (Multi-tier client component)

Windows Host -- 32bit OpenLink Request Broker (Multi-tier Server component) 32bit OpenLink Agent for ODBC Data Sources (Multi-tier Server component) Microsoft Access .mdb file + configured Access ODBC Data Source (DSN)

Garry M. Biggs
  • 232
  • 1
  • 1
  • Do you have an association with the makers of OpenLink? The fact that more than half your posts on SO recommend it looks suspicious... – David-W-Fenton Jul 28 '11 at 22:11
  • Yes - I work for OpenLink Software - who are writers of commercially available ODBC/JDBC/.Net Drivers/Providers etc... There is no ill intent meant by my posts. I simply propose our products as a solution in frequently mis-understood scenarios... – Garry M. Biggs Aug 12 '11 at 15:43
  • 1
    I think you enhance the credibility of your response when you explicitly mention your association. When you don't, it leaves one asking questions... – David-W-Fenton Aug 13 '11 at 21:47