Databases supported by CakePHP

One of the most recurring questions on CakePHP User Group is probably “Does Cake support X database?”. Sure, most of us tend to use just MySQL for our websites and applications, but in certain situations some more exotic database support makes the difference. A partial answer to the question above could be “Yes, probably, at least partially”: CakePHP offers support for some database “natively” (i.e. Cake folks made some ad hoc database drivers), others through either ADOdb or PEAR::DB.

CakePHP seems to use a multiple level database abstraction: in other words, popular abstraction layers like ADOdb or PEAR::DB have been wrapped in a “driver” which basically extends the DboSource class (which is the most high level database abstraction). Some people don't like the idea, because this means that the could be some performance issues, for one, and also that inevitably not all features offered by either ADOdb or PEAR::DB are used. In my very, very, very modest opinion (I'm not an expert on this matter), this solution focus on achieving good database compatibility leaving the doors open for further tinkering, if needed.

Having said this, yes, the possibilities are good that your favorite database is supported by CakePHP, more or less. Of course, as repeatedly pointed out by some CakePHP core developers, Cake dev team didn't and is not going to test every database with Cake, using either of the two abstraction layers, but users are more than welcome to do so.

Let's now have a look at what is known to work with Cake:

MySQL works fine, and is currently recommended as preferred database solution. What about MySQLi? Well, thanks to mappleJoe there's a (PHP5 only!) driver ready to be used.

*PostgreSQL*'s support is continuously improving. Something may work, something may not: the good news is that the folks who are using it are sharing their thoughts with the rest of us.

SQLite is supported natively, or so it seems… what about the newest SQLite3? Yes, probably: there's a quick howto on ThompsonLife.net to make it work through the dbo_pear driver.

Access works through the ADOdb driver, as reported in CakePHP wiki (thanks ivanp).

FileMaker is getting there: things aren't that easy, but bdb is doing all his best to make it work, good luck!

Neil Fincham was also trying to develop a custom driver to support Pervasive through a unixODBC driver. Best of luck!

For other databases, check ADOdb's list of supported databases and use the dbo-adodb driver, or use PEAR::DB (for fbsql, ibase, informix, msql, mssql, mysql, mysqli, oci8, odbc, pgsql,sqlite and sybase) using the dbo-pear driver.