Skip to content

Instantly share code, notes, and snippets.

@cirpo
Created June 27, 2010 08:41
Show Gist options
  • Save cirpo/454761 to your computer and use it in GitHub Desktop.
Save cirpo/454761 to your computer and use it in GitHub Desktop.
<?php
var_dump(Pdo::getAvailableDrivers());
foreach (Pdo::getAvailableDrivers() as $driver => $d) {
try {
echo $dsn = $d . ':dbname=testdb;host=127.0.0.1';
echo PHP_EOL;
$dbh = new PDO($dsn, 'dbuser', 'dbpass');
} catch(PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
}
try {
echo PHP_EOL;
echo $dsn = 'cirpo:dbname=testdb;host=127.0.0.1';
$user = 'dbuser';
$password = 'dbpass';
$dbh = new PDO($dsn, $user, $password);
} catch(PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment