CakePHP use MS Access database (.mdb, not accdb): Do I need to write a driver? How to build it?

帅比萌擦擦* 提交于 2019-12-11 07:38:41

问题


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).

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.

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.

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).

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.

Edit 1:

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?


回答1:


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




回答2:


This example is to big to write here it-s from cake bakery Please test it and i'm here for other problems



来源:https://stackoverflow.com/questions/9606959/cakephp-use-ms-access-database-mdb-not-accdb-do-i-need-to-write-a-driver-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!