all repos — h3rald @ 19e4a5e256c7bbd728825af8bd1f16b7abbb9137

The sources of https://h3rald.com

content/articles/16.textile

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
----- 
permalink: "16"
filters_pre: 
- redcloth
title: Databases supported by CakePHP
comments: []

date: 2006-04-17 07:30:00 +02:00
tags: 
- cakephp
- web-development
- databases
type: article
toc: true
-----
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":http://adodb.sourceforge.net/ or "PEAR::DB":http://pear.php.net/package/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. 

!<http://base--/img/pictures/postgres.png! 

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":http://cakephp.org/pastes/show/770e73e77e4d7a3d32c2f3de3f175512 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":http://groups.google.com/group/cake-php/browse_thread/thread/85a29ab6ec6826a0/8eecea26ba53e1fd?q=postgres&rnum=1#8eecea26ba53e1fd with the rest of us.

!>http://base--/img/pictures/sqlite.gif! 

*SQLite* is supported natively, or so it seems... what about the newest SQLite3? Yes, probably: there's a quick "howto":http://www.thompsonlife.net/index.php?section=9 on ThompsonLife.net to make it work through the dbo_pear driver.

*Access* works through the ADOdb driver, as reported in CakePHP "wiki":http://wiki.cakephp.org/docs:databases (thanks ivanp).

"FileMaker":http://www.filemaker.com/ is getting there: things aren't that easy, but bdb is doing "all his best":http://groups.google.com/group/cake-php/browse_thread/thread/572d8dd2ba4cbdf7/dca851c795247c0b?q=database&rnum=2#dca851c795247c0b to make it work, good luck!

Neil Fincham was also trying to develop a custom driver to support "Pervasive":http://www.pervasive.com/ through a "unixODBC":http://www.unixodbc.org/ driver. Best of luck!

For other databases, check ADOdb's "list of supported databases":http://phplens.com/adodb/supported.databases.html 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.