1
votes

I have a problem is that I can't connect to the SQL Server database (with ODBC), I have the php_pdo_odbc driver on my extension folder and this line in file php.ini (extension=php_pdo_odbc.dll)

Code :

 <?php  

  $db_serveur = 'X.X.X.X'; 
  $db_user='user_demo';   
  $pwd = '';  
  $db_DSN = 'DSN_test'; 


  $conn= odbc_connect("Driver={SQL Serve};Server=$db_serveur;Database=$db_DSN;", 
  $db_user, $db_DSN);  ?>

error :

enter image description here

i have test this but the same problem :

$conn=odbc_connect($db_DSN,$db_user,$pwd);

enter image description here

thanks

1

1 Answers

0
votes

Your connection line should be :

$dbConn = odbc_connect($dns, $dbUser, $dbPass, $dbName);

Further, please have a look http://php.net/manual/en/function.odbc-connect.php