Making the connection
To use these classes, we first need to make a connection to the database by including and getting an instance of the xPDO class, using a string DSN representation of the database connection. For mysql, this initial code would look something like this...
include_once (strtr(realpath(dirname(__FILE__)), '\\', '/') . 'xpdo/xpdo.class.php');
$xpdo= new xPDO('mysql:host=localhost;dbname=mydb', "mydbuser", "mydbpass");
If there is a problem connecting to the database, PDO will throw an Exception in PHP 5, or an Error in PHP 4. See the PDO documentation for more information on connecting with PDO.