Guest User

Untitled

a guest
Dec 28th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2.  
  3. // Now connect to an Azure SQL database by setting Authentication to ActiveDirectoryPassword
  4. $azureServer = "vgissql";
  5. $azureDatabase = "dbo.pctProjectTracking";
  6. $azureUsername = "myuid";
  7. $azurePassword = "mypassword";
  8. $connectionInfo = "Database = $azureDatabase; Authentication = ActiveDirectoryPassword;";
  9.  
  10. try
  11. {
  12. $conn = new PDO( "sqlsrv:server = $azureServer ; $connectionInfo", $azureUsername, $azurePassword );
  13. echo "Connected successfully with Authentication=ActiveDirectoryPassword.n";
  14. $conn = null;
  15. }
  16. catch( PDOException $e )
  17. {
  18. echo "Could not connect with Authentication=ActiveDirectoryPassword.n";
  19. print_r( $e->getMessage() );
  20. echo "n";
  21. }
  22.  
  23. ?>
Add Comment
Please, Sign In to add comment