tags:

views:

494

answers:

4

Both seem to try making it simpler using a database in PHP. Both seem to provide an abstraction over different database types like MySQL, SQLite, etc.

What are the differences between both ADOdb and PDO?

+1  A: 

Well, I think it boils down to preference. ADOdb is more geared towards people who are used to the Microsoft style of Database access (ADO) and PDO is more "PHP" like and also part of the mainstream of PHP versus ADOdb which sort of sits off to the side.

At the end of the day, it would based on what your target DB is (ADOdb supports more) and what sort of language style your prefer. Personally, I like PDO and it suits my needs.

Kitson
+2  A: 

From a technical perspecitve, the most notable difference would be that PDO is a native extension and, from PHP 5 on, always included in PHP in its fast, compiled form. There is an extension for ADODb as well but you have to install it in PHP first. This is a strong argument in favour of PDO because products based on it are likely to run faster in more environments.

ADOdb supports a larger number of databases than PDO.

Pekka
Good point re. broader database support. Then again, you could perhaps use PDO_ODBC for the more exotic ones, although I can imagine that being noticebly slower than PHP native PDO drivers.
Roland Bouman
+2  A: 

PDO is standard in PHP as of version 5.1. (It is also available with a PECL extension in PHP 5.0) Most hosting provides will have it enabled. AdoDB is not a standard extension.

Also, I believe the PDO drivers are "PHP-native": they are built on top of the same libraries that PHP itself was built on, and use the same underlying routines for things like memory management. So potentially, PDO is more lightweight than AdoDB.

According to this benchmark, AdoDB is considerably slower than PDO: http://tonylandis.com/perfomance/php-adodb-pdo-mysql-database-apc-benchmark/

Of course, you should consider whether this is important enough for your use case to prefer PDO or not.

Roland Bouman
Thanks, you made it nice and easy to choose!
Rowan
+1  A: 

PDO is native and pretty fast.

ADOdb is a richer library and even has things like ORM (Object Relational Mapping).

For me the big downside of PDO is it's horrible to debug when it goes wrong as there's no PHP source for it. When I was debugging some complicated code the only way I could see the exact SQL that was being executed was the subclass the PDO driver itself...

It's all opinion though of course!

Forbes Myester