Wednesday, June 5, 2013

what supported PDO driver in php

  • PDO_DBLIB ( FreeTDS / Microsoft SQL Server / Sybase )
  • PDO_FIREBIRD ( Firebird/Interbase 6 )
  • PDO_IBM ( IBM DB2 )
  • PDO_INFORMIX ( IBM Informix Dynamic Server )
  • PDO_MYSQL ( MySQL 3.x/4.x/5.x )
  • PDO_OCI ( Oracle Call Interface )
  • PDO_ODBC ( ODBC v3 (IBM DB2, unixODBC and win32 ODBC) )
  • PDO_PGSQL ( PostgreSQL )
  • PDO_SQLITE ( SQLite 3 and SQLite 2 )
  • PDO_4D ( 4D )
example use
try {   
 # MS SQL Server and Sybase with PDO_DBLIB   
  $DBH = new PDO("mssql:host=$host;dbname=$dbname, $user, $pass");   $DBH = new PDO("sybase:host=$host;dbname=$dbname, $user, $pass"); # MySQL with PDO_MYSQL   
 $DBH = new PDO("mysql:host=$host;dbname=$dbname"$user$pass);    
# SQLite Database 
   $DBH = new PDO("sqlite:my/database/path/database.db"); 
 catch(PDOException $e) {   
   echo $e->getMessage();   


No comments:

Post a Comment