sql server - PHP/MSSQL Connection -


i have following code doesn't seem make connection mssql db:

<?php $servername = "sever_name\sqlexpress"; //servername\instancename  $connectioninfo = array( "database"=>"testdb",                            "uid"=>"server_name\administrator",                            "pwd"=>"password123");  $conn = sqlsrv_connect( $servername, $connectioninfo);  if( $conn ) {      echo "connection established.<br />"; } else{      echo "connection not established.<br />";      die( print_r( sqlsrv_errors(), true)); }  ?> 

the message reads login failed user server_name\administrator, that's see in sql server management studio when check db properties. appreciated.

the login name looks suspiciously sql server using windows authentication. if script , sql server on same machine, try omitting uid , pwd entirely, per documentation.

if values uid , pwd keys not specified in optional $connectioninfo parameter, connection attempted using windows authentication.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -