When I run Apache (via XAMPP) as a standalone server (not as a service), the following code works fine (username and password removed)
$server = "WMS";
$link = odbc_connect($server,'','');
if (!$link) {
die('Something went horribly wrong while connecting to MSSQL');
}else {echo('');}
However, when I change Apache to run as Windows service, the connection breaks up and I’m getting following error message:
Warning: odbc_connect() [function.odbc-connect]: SQL error:
[Microsoft][ODBC Driver Manager] Data source name not found
and no default driver specified, SQL state IM002 in SQLConnect
in C:\xampp\htdocs\Dev\well.php on line 30.
Something went wrong while connecting to MSSQL
This is Windows Server 2008 issue.
Running apache as a service meant windows was no longer logging in to the SQL server which was my method of authentication
switching SQL Server to SQL and Windows Authentication meant that the web app could login with the credentials provided in the line
so long as they matched a user in the security and login section of the server setup and those users were set as SQL Authentication type users