Conexao SQL via PHP

Category: sql server driverphp

Question

JonnySEP on Thu, 06 Jul 2017 19:55:37


Boa tarde!

Estou tentando conecatr no SQL via PHP, com usuário e senha eu consigo, porém com windows authentication não da certo.

Algém sabe como conecatr no SQL via PHP utilizando windows authentication?

Att.

Jonny

Replies

Hilary Cotter on Thu, 06 Jul 2017 20:04:00


Here is an example of how to do it using Windows Authentication.

https://docs.microsoft.com/en-us/sql/connect/php/how-to-connect-using-windows-authentication

https://docs.microsoft.com/pt-pt/sql/connect/php/how-to-connect-using-windows-authentication

<?php  
/* Specify the server and connection string attributes. */  
$serverName = "(local)";  
$connectionInfo = array( "Database"=>"AdventureWorks");  

/* Connect using Windows Authentication. */  
$conn = sqlsrv_connect( $serverName, $connectionInfo);  
if( $conn === false )  
{  
     echo "Unable to connect.</br>";  
     die( print_r( sqlsrv_errors(), true));  
}