douliang2087 2016-02-17 11:47
浏览 57
已采纳

使用PHP的MDB数据库和MySQL [关闭]

I am working for a client who had a website developed and doesn't want the backend changing. Unfortunately he is on windows and used an MDB database D:

That database is on a different server...

I need to be able to access that database from www.domain2.com

The database is on www.domain1.com/Admin/DataBase/DB.mdb

Accessing it through the URL isn't possible. You have to use the ftp path:

ftp.domain1.com/htdocs/Admin/DataBase/DB.mdb

What can I do to get around this? I was thinking if it would be possible to make a MySQL database which will be a constant duplicate of the MDB file. Is that possible? I doubt it though.

The other option I thought of was accessing that mdb file. But how, I can't access it through the www, I'd need to use FTP.

  • 写回答

1条回答 默认 最新

  • dprfe04886 2016-02-17 12:21
    关注

    You probably can't meet this client's needs in a reliable way. The results of this "integration" will probably end up being Worse Than Failure™. If you proceed with this job, please be sure you arrange to bill your client hourly for maintenance. There's no obvious reason for you to take a vow of poverty to support this ill-conceived scheme.

    If the Access database (the mdb file) is relatively static, you can write a bunch of application specific code to sync its tables to a real RDMS like MySQL. If you do this in PHP, you'll use the ODBC driver. http://php.net/manual/en/function.odbc-connect.php

    The machine on which the php sync program runs will have to have Windows-style CIFS or SMB file-system access (not, repeat not, FTP access) to the mdb file. You'll need to make the mdb file available in a network share, for that to work.

    This shared-access to mdb setup is a potential source of unreliability. You can mitigate some of that by only reading, and never writing, the mdb file from your php program. You can also allow for recovery by making sure you have solid backups on the mdb file.

    If your php sync program, and indeed any program touching the mdb file, can be run in a Windows environment, it will help maintain the mdb file's integrity.

    Once you've pulled data from the mdb file using ODBC and put it into an RDMS, you can create your web site normally.

    Another alternative: hybrid solution. Read application data from the mdb file, and read/write web-site data (passwords, sessions, and the like) to the RDMS.

    It may make sense to try to convince your client to migrate from access to a modestly-sized MS SQL Server database. That's a fairly well-travelled path. If you do that, you can connect your php program directly to SQL Server.

    This project sounds like your client saying, "I want to take all my customers to New York City. I have this bicycle. Can you drive it and carry them all?"

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥30 用arduino开发esp32控制ps2手柄一直报错
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿