简体   繁体   English

内网PHP查询Access数据库

[英]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: 我知道还有其他有关如何使用PHP查询MS Access数据库的问题,但我的情况略有不同:

Currently my company is using a program a former employee developed in MS Access. 目前,我公司正在使用MS Access中一名前员工开发的程序。 The program is severely outdated and the VBA inside is just a mess its not worth fixing. 该程序已严重过时,内部的VBA只是一团糟,不值得修复。 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). 他使用两个ODBC连接来连接和查询由公司控制的SQL数据库(即-我们对此没有管理员访问权限)。 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. 我认为开发一个PHP驱动程序来复制旧程序会很有趣,但是我们希望拥有一些其他功能。

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. 这里的问题是,即使效率非常低,我仍可能需要查询位于我们的Intranet上的MS Access数据库程序(查询公司SQL文件),而且我不知道PHP是否可以查询私有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? 是否有可能开发托管在服务器上的PHP应用程序,但查询位于私有Intranet上的Access数据库?

Or, is it possible to host the PHP application on our intranet - that way it would be easy to query the Access database? 或者,是否可以在我们的Intranet上托管PHP应用程序-这样一来,便可以轻松查询Access数据库?

If either, could you provide some advice on how I could achieve this? 如果有的话,您能提供一些有关如何实现这一目标的建议吗?

You can use db odbc >> http://www.w3schools.com/php/php_db_odbc.asp 您可以使用db odbc >> http://www.w3schools.com/php/php_db_odbc.asp

Also Try using PDO 也尝试使用PDO

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM