Guest User

Untitled

a guest
Mar 5th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. $serverName = "serverName";
  2. $dbusername = "dbusername";
  3. $dbpassword = "dbpassword";
  4. $dbname = 'dbname';
  5.  
  6. $connectionInfo = array( "Database"=>$dbname, "UID"=>$dbusername, "PWD"=>$dbpassword);
  7.  
  8. $link = sqlsrv_connect( $serverName, $connectionInfo);
  9.  
  10. if( $link !== false ) {
  11. echo "Connection established.".PHP_EOL;}
  12. else{
  13. die( print_r( sqlsrv_errors(), true));
  14. }
  15.  
  16. Array(
  17. [0] => Array
  18. (
  19. [0] => IMSSP
  20. [SQLSTATE] => IMSSP
  21. [1] => -49
  22. [code] => -49
  23. [2] => This extension requires the Microsoft ODBC Driver 11 or 13 for SQL Server. Access the following URL to download the ODBC Driver 11 or 13 for SQL Server for x64: http://go.microsoft.com/fwlink/?LinkId=163712
  24. [message] => This extension requires the Microsoft ODBC Driver 11 or 13 for SQL Server. Access the following URL to download the ODBC Driver 11 or 13 for SQL Server for x64: http://go.microsoft.com/fwlink/?LinkId=163712
  25. )
  26. [1] => Array
  27. (
  28. [0] => IM002
  29. [SQLSTATE] => IM002
  30. [1] => 0
  31. [code] => 0
  32. [2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
  33. [message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
  34. )
  35. )
Add Comment
Please, Sign In to add comment