本文介绍了CakePHP使用MS Access数据库(.mdb,而不是accdb):是否需要编写驱动程序?如何建造?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很不幸,我的客户需要使用只读的MS Access数据库来在他的网站(由我创建)上呈现某些网页内容.

I'm in the unlucky situation where my client requires to use a read-only MS Access database to render some webpage contents on his website (built by me).

由于该MS Access文件大约每月都会更新一次,并且我不想通过将其转换为sql查询并导入Mysql来手动进行处理,因此我想直接从中读取一些网页.

Because this MS Access file will be updated roughly once per month and I don't want to do it manually by converting it into sql query and import in Mysql, I would like to make some webpages read directly from it.

我发现的是,没有用于MS Access数据库的驱动程序(至少在我的cakephp安装中)(但是在cake的旧版本中存在),或者至少我没有找到任何驱动程序.

What I discovered is that there isn't a driver (at least in my cakephp installation) for MS Access database (but in older versions of cake exist) or at least I didn't find any of them.

我需要知道最终在哪里可以找到这样的驱动程序,或者如何只为读取操作正确实现其中的一个(我认为我应该实现DboSource类,但是我不知道应该重写什么,因为没有诸如此类的虚拟抽象界面可以指导我进行操作).

I need to know where eventually I can find such drivers or how to correctly implement one of them only for read operations (I think I should implement DboSource class, but I don't know what should I override because there isn't anything such virtual or abstract or interface that guide me through this).

我什至不知道该创建Adodb驱动程序还是OleDB驱动程序.我还认为Sqlserver驱动程序与我应该构建的驱动程序非常相似(除了connection和一些细节);如果我可以以某种方式使用它来缩短我的工作,那将是有帮助的.

I didn't even understand if I should create an Adodb driver or an OleDB driver. I also think that Sqlserver driver is a lot similar to what I should build (except for connectionand some details); if I can use it in some way to shorten my job, it will be helpful.

由于没有人回答,我可以说我可以将MS Access也用于正常"查询(不需要将每个表都绑定到模型),但是我必须确保已将其清理并输出数组类似于蛋糕实际输出的内容: $ jobs ['jobs'] ['name']

Because no one is answering, I can say I'm ok to use MS Access also with "normal" queries (without requiring each table to be bound to a model) but I must be sure that are sanitized and will output arrays similar to what cakes output actually: $jobs['jobs']['name']

关于如何实现这一目标的任何建议?

Any suggestion on how to achieve this?

推荐答案

也许来自 https://github.com/cakephp/datasources/tree/2.0/Model/Datasource/Database 是否可以与MS Access一起使用?

Maybe the Adodb or Odbc datasources from https://github.com/cakephp/datasources/tree/2.0/Model/Datasource/Database work with MS Access?

这篇关于CakePHP使用MS Access数据库(.mdb,而不是accdb):是否需要编写驱动程序?如何建造?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 14:34