I'm working on getting information from a submitted HTML form entered automatically into an Access 2016 database. My understanding of this process is limited, so I ask that you bear with me.
The HTML form is stored on a 64-Bit Windows Server 2008 R2 DC that is doubling as a Web Server. PHP has also been installed and configured on this Server.
The database is stored on a separate 64-Bit Windows Server 2008 R2 Virtual Server.
I've seen plenty of articles regarding PHP and SQL (MySQL, SQL Server, etc.) but very little about PHP and MS Access. I understand now that I need to set up an ODBC Connection but that's where I begin to get lost.
Questions:
Am I correct in thinking the ODBC Connection needs to be set up/configured on the Web Server?
Am I correct in thinking only the 64-Bit ODBC Driver is required? (Although I'm pretty confident this is correct, I have this nagging doubt that, because some 32-Bit computers will be accessing the HTML form, there will also be a need to have the 32-Bit ODBC Driver. It may seem silly but I'd like confirmation with regards to this.)
Where is the ODBC driver? I did a search and it brought me to a download for "Microsoft Access Database Engine 2010 Redistributable". Is this what I'm looking for? (I admit that, unless it's pretty obvious, I tend to feel I'm in the wrong place. And unless someone can confirm that 'Redistributable' is the same as 'ODBC Driver', I'm inclined to think I'm looking at the wrong thing.)
Thanks for any help!
Eric
Since all of the code running on your web service is x64, then yes of course you will need the x64 Access (ACE) odbc driver.
You are correct in choosing Access Database Engine 2010 Redistributable. In fact, you might as well use the 2013 one. Don’t forget to choose the x64 version.
The fact that x32 or x64 computers connect to the web site is not relevant – the server and web code is running as an x64 in process and thus you need to use the x64 odbc driver for Access.
Also while the accDB access file CAN BE on the other server as you point out, that file name MUST be in a folder that that the web server has full rights to. So you not using an IP address, but a FULLY qualified windows path name to a legal windows folder and a legal windows file (in this case the access accDB file). So keep in mind that you do not connect to an Access database, but in fact are opening a windows file. You don’t connect to a word document, you open it. You don’t connect to a PowerPoint file, you open it. And you don’t connect to an Access accDB file, but your software (the odbc driver) will in fact do a DIRECT windows OS file open of the Access file.
So unlike a web site or say SQL server that allows a connection via a socket (tc/ip + a IP address), an Access file is NOT a socket based system, but is in fact a plane jane windows file that will be opened in-process by YOUR software. So the opening of the Access file occurs on the web server – even if that Access accDB simply a USB jump drive plugged into that server, or some other file share on the servers network. We talking about the code on the web server opening that Access file – that Access file thus must be located in a folder that is directly accessible by the web server code running.
Thus you don’t need the ACE data engine installed on that second server for example – only where the code is running do you need the ODBC driver. The significant issue here is that most ODBC drivers allow you to “connect” to some server with a database engine. Because Access is file based then BOTH the ODBC driver and the data engine MUST be installed on the computer that uses the ODBC driver. That driver thus will ALWAYS launch a copy of the data engine local and on the same computer using the ODBC driver. When you use say a SQL driver, you requite a local copy of the SQL database engine – with Access you do!
Related
I need to pull data from MS Access 2007 (both mdb and accdb files) for a website written in PHP 7. The pages don't need to be dynamic or interactive. They just need to present data stored in the database.
Local development environment: Windows 7, IIS 7.5
Online server: A2 Hosting, Linux (CloudLinux Server release 6.9), Apache/2.2.34
The ADOdb webpage for Access says "Windows Yes, Unix No". I presume this means I can use ADOdb to connect to Access in my local environment, but not on the online server. I suppose I have the following options:
StackOverflow has some questions on this (1, 2, 3) with answers that give code for connecting to Access in PHP. Although the answers don't say so, I am guessing that that code will only work in Windows because if it were that easy to connect to Access in PHP in Unix, then ADOdb would do it! So if I'm right about this, then this is not a workable option.
The PHP Manual has a page on Database issues that says PHP can access Access, but it seems to only apply to either running in Windows or "running PHP on a Unix box and want to talk to MS Access on a Windows box". So this also does not appear to offer a workable solution for running the website online on a Linux server.
Extract the parts of the database needed into something else that can be accessed in Unix, such as CSV files, and use that as the database for the website. If I do this with CSV, I suppose I don't need ADOdb, but would just use fgetcsv(). This is an inelegant solution, but may be the best thing to do if there's not a way to access Access directly in Unix. (I could use MySQL instead of CSV, but that seems like a lot of unnecessary overhead.)
Run the pages on my Windows machine using ADOdb to access Access. Save the parts of the pages that come from the database as separate HTML segment files and include() them when the pages run online. (The script could detect which environment it's running in and if it's local, then access the database, and if online, then include() the HTML segment files.)
Move the online website from Linux to a Windows server, so PHP can access Access directly using ADOdb.
Convert the entire database from Access to something else, such as MySQL. This is not practical at this time, although that may be an option in the future.
Have I understood my options correctly? I've listed them in what seems to me to be the order of preference, so unless someone suggests otherwise, I guess I'll go with the third one (extract to CSV, use fgetcsv(), no ADOdb) since the first two won't work.
Thanks for your help.
The main problem is the ODBC driver. The {Microsoft Access Driver (*.mdb, *.accdb)} comes with Microsoft Access or the Microsoft Access Database Engine, which are both Windows-only.
However, there are alternate ODBC drivers that work on Unix and unixODBC. A popular open source one is mdbtools, which is limited, but can be used to connect Access to PHP on unix using PDO and ODBC. There are also commercial alternatives that are more fully featured.
Once you've got that working, it shouldn't be a problem to use the ODBC driver in PHP. Note that on shared hosting, this might not be possible.
Alternatively, you can use a php-jdbc bridge with UCanAccess. This might still be all-open-source and more fully-featured than mdbtools, but is more complex to set up correctly.
You don't need to convert "the entire database" from Access to use Mysql, just the tables. You can then link them back into the Access database using the MySql odbc connector and so long as the table names are the same you won't even notice the difference, all your forms, queries and everything will work.
You would then have MySql server running on your local machine which, if you create a user with the right permissions and port forward through your router (directing traffic from port 3306 or whichever port you assign to your server, to your machine) and allow the traffic through your firewall, your website can then access, read and write to your database.
If you want to query the database from php mysqli_query will work just fine. Most websites that run from data run using MySql, so this is a future proof solution too.
we have a Tool for managing the booked time at the different prjects of our customers an other things based on MS Access and we want to continue with it. Just for a better comfort I've made an PHP based Tool that is able to work with that database but it runs local on a windows system. Now I'd like to run it on our office webserver but that is a Linux system.
I use the PDO extension odbc and found the following docu to use the odbc extension on linux:
https://gist.github.com/amirkdv/9672857
But this only allows me to read the databse.
Do anybody knows a way to get full access to a MS Access Databse on a Linux system?
I'm looking forward to your answers^^
The Access database (not the application) doesn't "run" anywhere, it's a file, so all you need an SMB share which, on Linux, is what Samba provides.
If you wish to run the Access application on Linux, you will need Wine.
Does anyone know if it's possible to connect and query an MS Access database from a Linux Server using PHP?
If it is possible I'm thinking install ODBC driver on the Linux server, but will it work to connect to Access is the question. I've read it's possible with MSSQL.
My knowledge is very limited when it comes to any Windows related DBs so any advice much appreciated.
Yes, it's possible. I've done it using ODBTP, which took advantage of the ODBC driver on the (Windows) machine that hosted the Access database file.
It's also theoretically possible to use an ODBC driver on the Linux server to read an Access database on a Windows networking share if the Linux box can "see" it. However, I've never had very good luck with Access ODBC on Linux so I wouldn't recommend spending too much time trying to get it working.
Does anyone know if it's possible to connect and query an MS Access database from a Linux Server using PHP?
If it is possible I'm thinking install ODBC driver on the Linux server, but will it work to connect to Access is the question. I've read it's possible with MSSQL.
My knowledge is very limited when it comes to any Windows related DBs so any advice much appreciated.
Yes, it's possible. I've done it using ODBTP, which took advantage of the ODBC driver on the (Windows) machine that hosted the Access database file.
It's also theoretically possible to use an ODBC driver on the Linux server to read an Access database on a Windows networking share if the Linux box can "see" it. However, I've never had very good luck with Access ODBC on Linux so I wouldn't recommend spending too much time trying to get it working.
I am a desktop application / database programmer customizing an ERP application in a Windows environment. I have also done documentation with HTML and javascript on our intranet. I have not done any web programming.
I need to convert an Access 2003 application. Instead of using .Net I think it would be wiser to use HTML to allow access from a tablet. This app will display drawings based on certain lookup values (i.e. part number) stored in a SQL server database. After some research it seems PHP is the best choice. But the things I have found explain on a server supplying the pages and not running locally. I see Apache and IIS mentioned but are these needed if the pages will be loaded on a single machine (or multiple machines but all pages will be present in a single directory structure).
When I search for running pages locally I get pages accessing a databse locally. But the database will be on a server.
Can someone steer me in the right direction?
if you want to use PHP then if you put your application online you can use MySql for the database. You will not need to make any changes because any web server uses mysql with php.
If you want to use PHP with SQL server then you will need on your server to install the Microsoft Drivers for PHP for SQL Server . in the following link you will have the documentation:
[www.microsoft.com/en-us/download/details.aspx?id=20098][1]
PHP has a built-in webserver since 5.4.0: http://php.net/manual/en/features.commandline.webserver.php
If you have PHP (>= 5.4) on your machine, you already have a webserver.
If i understand your question correctly you want to have the database on the tablet. That is possible, simply by installing the web and database server locally. Restrictions might apply depending on your tablet (OS) manufacturer though.
You could also have a "regular" web server / database server setup, and use the localstorage of your tablet's browser to have the result pages available in offline mode, and sync your data when possible, using php and maybe ajax scripts.
Since you don't want the presented data to be web-accessible (or at least not public), but you do want the presentation to be through HTML-pages, I can come up with two ideas:
Use a scripting language to access MS SQL Server, extract the data, and present it as HTML. Since you like PHP, maybe Perl with a suitable DB-access library might be a good idea.
PHP as you suggest, some kind of web-server, and a rigorous lock-down configuration so that the webserver is only accessible locally. Depending on the sensitivity of your data, this might be the worse option.
Enable Internet Information Server on your Windows system (using "Turn Windows Features on or off in the control panel) and install PHP: http://php.iis.net/
Alternatively Apache xampp installs the Apache webserver, MySQL (when wanted) and PHP on your system: https://www.apachefriends.org/index.html. To connect to Sql Server you have to remove the semicolon ; before the extension=php_mssql.dll line in the php.ini.