PDO
From GLMWiki
$dbh = new PDO( 'pgsql: host=localhost dbname=demo user=nobody', null, null, array( PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC ) ); $dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $dbh->query("SET DATESTYLE TO 'SQL, US'");