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 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
  • ¥15 活动选择题。最多可以参加几个项目?
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀