I have noticed there's no datasource for Oracle in CakePHP 2.0 for the moment, although it seems they are working on in it now: http://ask.cakephp.org/questions/view/any_news_about_oracle_datasource_with_cakephp_2_0
There are some people explaining how to use an Oracle DB adapting some code from CakePHP 1.3: http://www.hassanbakar.com/2012/01/09/using-oracle-in-cakephp-2-0/ http://liamgraham.wordpress.com/2007/04/19/using-oracle-with-cakephp-15-minute-blog-tutorial/
But I'm not sure that's the correct way. If it was so simple, they would have released the feature already for CakePHP 2.X...
Would I have any trouble using that "cheat"?
I want to connect CakePHP with PL/SQL procedures and a desktop application and they are working over Oracle. I can not change that.
After asking some CakePHP developers I came out with the conclusion that it is not possible to use an Oracle Database with CakePHP 2.3 if you want to make a proper use of CakePHP Models and their query syntax. There's no yet available any driver for Oracle in CakePHP which is completely functional.
Therefore, the solution I found was to use the OCI8 Functions of PHP.
Like this i could use oci_parse
to directly query against the DB or rather call a PL-SQL procedure which is what I finally decided to do. (because of the sql functions complexity and the division of task inside my work group)
Now, I can not make use of many of the advantages of using CakePHP models, but It was the only way.
There is a new CakePHP 3 Driver for Oracle Database released (MIT) and working with Oracle 11g and Oracle 12c databases. Some features:
- Triggers
- Sequences
- Cursors
- Stored procedures
- Packages
- All the basic CRUD features to allow select/insert/update/delete rows.
- CakePHP Pagination
- CakePHP Bake code generation
Check the Documentation here, and the release announcement here.
来源:https://stackoverflow.com/questions/14376743/using-oracle-database-with-cakephp-2-0