Search code examples
phpsqlms-accessintranet

PHP query Access database on Intranet


I know there are other questions about how to query a MS Access database using PHP, but my situation is a little different:

Currently my company is using a program a former employee developed in MS Access. The program is severely outdated and the VBA inside is just a mess its not worth fixing. He used two ODBC connections to connect to and query SQL databases that are controlled by corporate (ie - we have no admin access to this). I thought it would be interesting to develop a PHP driven program that will replicate the old program, but with some additional features we all desired.

The issue here is that even though its highly inefficient, I will likely need to query an MS Access database program (which queries corporate SQL files) located on our intranet and I don't know if PHP can query a private intranet.

Is it possible to develop a PHP application that is hosted on a server, yet queries an Access database located on out private intranet?

Or, is it possible to host the PHP application on our intranet - that way it would be easy to query the Access database?

If either, could you provide some advice on how I could achieve this?


Solution

  • You can use db odbc >> http://www.w3schools.com/php/php_db_odbc.asp

    Also Try using PDO

    <?php
        try{
            $dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\accounts.mdb;Uid=Admin");
        }
        catch(PDOException $e){
            echo $e->getMessage();
        } 
    ?>