Using Oracle database with CakePHP 2.0
Asked Answered
E

2

5

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.

Ether answered 17/1, 2013 at 10:16 Comment(0)
E
5

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.

Ether answered 8/2, 2013 at 15:9 Comment(0)
J
3

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.

Janey answered 15/3, 2016 at 11:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.