Advertisement
Guest User

Untitled

a guest
Aug 8th, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. $server = SERVER
  2. $port = PORT
  3. $user = USER
  4. $password = PASSWORD
  5. $database = DATABASE
  6.  
  7. ### MYSQL ###
  8.  
  9. $connection = new PDO("mysql:host=$server;dbname=$database;charset=utf8",$user,$password);
  10.  
  11. ### SQLSRV ###
  12.  
  13. $connection = new PDO("sqlsrv:Server=$server,$port;Database=$database;charset=utf8", $user, $password);
  14.  
  15. ### ORACLE ###
  16.  
  17. $connection = new PDO('oci:dbname=$server/$port;charset=AL32UTF8', $user, $password);
  18. // or
  19. $tns = "(DESCRIPTION =
  20. (ADDRESS = (PROTOCOL = TCP)(HOST = $host)(PORT = $port))
  21. (CONNECT_DATA =
  22. (SERVER = DEDICATED)
  23. (SERVICE_NAME = $database)
  24. )
  25. )";
  26. $connection = new PDO('oci:dbname=$tns;charset=AL32UTF8',$user,$password');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement