Reputation: 541
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!
Upvotes: 1
Views: 1488
Reputation: 230
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)
Upvotes: 0
Reputation: 23067
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).
Upvotes: 0
Reputation: 806
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.
Upvotes: 1