1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/manual/docs/en/connection-management/opening-a-new-connection.txt
2007-10-25 14:23:42 +00:00

14 lines
386 B
Plaintext

Opening a new database connection in Doctrine is very easy. If you wish to use PDO (www.php.net/PDO) you can just initalize a new PDO object:
<code type="php">
$dsn = 'mysql:dbname=testdb;host=127.0.0.1';
$user = 'dbuser';
$password = 'dbpass';
try {
$dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
</code>