- PDO is an attempt to solve the problem of porting PHP applications to different database
- Written in C for maximum performance
- Defaults to forward-only cursors (unbuffered queries) for performance and small memory footprint
- Implements prepared statements with parameter markers for performance and to avoid SQL injection attacks
- PDO interface consists of two different objects:
- PDO connection object: AUTOCOMMIT is enabled by default
- exec() - executes SQL directly
- prepare() - prepares SQL and returns PDOStatement objects
- beginTransaction(), commit(), rollback() - handles transactions
- PDOStatement object
- execute() - executes queries
- fetch() - returns results
PDO drivers implement the common PDO interface but provide access to different databases: PDO_DBLIB,
PDO_FIREBIRD,
PDO_MYSQL,
PDO_OCI,
PDO_ODBC,
PDO_PGSQL, and
PDO_SQLITE.
To connect to Apache Derby, we must use the PDO_ODBC driver.