PHPBuilder - Database Abstraction in PHP Page 2



RSS Twitter
Articles Databases

Database Abstraction in PHP - Page 2

by: Ian Gilfillan
|
September 7, 2005

Metabase

Developed by Manuel Lemos, Metabase has a reputation as one of the slower abstraction layers (see the above benchmarks), but then it does support all the way back to PHP 3, as is also designed for maximum portability.
Metabase currently supports:
  • Access
  • Informix
  • Interbase
  • mSQL
  • MS SQL
  • MySQL
  • ODBC
  • Oracle
  • PostgreSQL
  • SQLite
You can download Metabase at http://www.phpclasses.org/browse/package/20.html#download and read more about it at http://www.phpclasses.org/browse/package/20.html. You can even run Metabase with PHP 3.

MDB

MDB is a merge between the PEAR:DB and Metabase database abstraction layers, as well as an attempt to improve the performance and portability of both. The first stable version was released in April 2004.
MDB currently supports the following:
  • Firebird
  • Frontbase
  • Interbase
  • MS SQL
  • MySQL
  • Oracle
  • PostgreSQL
  • Querysim
You can download PEAR:MDB at http://pear.php.net/package/MDB/download, and read more about it at http://pear.php.net/package/MDB. It requires at least PHP 4.2.

MDB2

PEAR:MDB2 takes the Metabase/PEAR:DB merge that begun with PEAR:MDB further, as well as working on consolidating the resultant bloated API. It also aims to integrate easily with PDO. As of August 2005, PEAR:MDB2 is still in beta.
PEAR:MDB2 currently supports:
  • Firebird
  • Frontbase
  • Interbase
  • MS SQL
  • MySQL
  • Oracle
  • PostgreSQL
  • Querysim
  • SQLite
You can download PEAR:MDB2 at http://pear.php.net/package/MDB/download, and read more about it at http://pear.php.net/package/MDB. It requires at least PHP 4.2.

Creole

Based on Java's JDBC, as well as to some degree on PEAR:DB, PEAR:MDB and ADOdb, Creole is a fairly new abstraction layer for PHP5. Not burdened with PHP 4 compatibility issues, Creole offers fully object-oriented API and support for PHP5 Exceptions.
Creole supports:
  • MySQL
  • MS SQL
  • Oracle (in progress)
  • PostgreSQL
  • SQLite
You can download it at http://creole.phpdb.org/wiki/index.php?node=2, and read more at http://creole.phpdb.org/. Creole requires PHP 5.

PDO

Still in beta, but one to watch for the future, PHP Data Objects will be part of the PHP 5.1 release. It's written in C, and interfaces with the native API's, so will be fast, though not as fully-featured as some of the others.
PDO currently supports:
  • Firebird
  • FreeTDS
  • Interbase
  • MySQL
  • MS SQL
  • ODBC
  • Oracle
  • PostgreSQL
  • SQLite
  • Sybase
You can read more about it at http://www.php.net/pdo. PDO requires PHP 5.1.

DBX

DBX is another, less talked about, database abstraction layer that, until PHP 5.1, was bundled with PHP. It's also fast, being written in C, but is lightweight, the primary benefit being it allows you to access all supported databases using a single calling convention (for example dbx_connect instead of mysql_connect). It was released around 2002, and now supports the following databases:
  • Frontbase
  • MS SQL
  • MySQL
  • ODBC
  • PostgreSQL
  • Sybase
  • Oracle
  • SQLite

PHPLib

PHPLib is now obsolete, and I put it here only because it was popular in its day, and you may still come across references to it. It was never actually designed as a fully-fledged database abstraction layer, rather it just aimed to encapsulate the connection string, and handle errors.

Conclusion

Don't buy into any hype that tells you you're inferior if you don't use abstraction layer X, or none at all. Think carefully about whether you need to use a database abstraction layer, and if so, which one. What sort of functionality, ease-of-use and scalability do you need? There's more than enough choices out there, and no need to reinvent the wheel. As a novice programmer I suggest you try use one, just to see what you've been missing out on. You can't really make up your mind without knowledge of both sides. As an experienced developer, hopefully you have the tools to make a wise decision. Perhaps this article has introduced you to one that may be suitable to your needs. Good luck.



« Previous Page
1
|
2

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Ian Gilfillan

Comment:



Comment:

(Maximum characters: 1200). You have characters left.