1
0
mirror of synced 2025-01-18 22:41:43 +03:00
doctrine2/manual/codes/Basic Components - Manager - Opening a new connection.php

19 lines
544 B
PHP
Raw Normal View History

2006-07-23 21:08:06 +00:00
<?php
// Doctrine_Manager controls all the connections
2006-07-23 21:08:06 +00:00
$manager = Doctrine_Manager::getInstance();
// Doctrine_Connection
// a script may have multiple open connections
2006-07-23 21:08:06 +00:00
// (= multiple database connections)
$dbh = new PDO("dsn","username","password");
$conn = $manager->openConnection();
2006-07-23 21:08:06 +00:00
2006-11-11 19:35:33 +00:00
// or if you want to use Doctrine Doctrine_Db and its
2006-07-23 21:08:06 +00:00
// performance monitoring capabilities
$dsn = "schema://username:password@dsn/dbname";
2006-11-11 19:35:33 +00:00
$dbh = Doctrine_Db::getConnection($dsn);
$conn = $manager->openConnection();
2006-07-23 21:08:06 +00:00
?>