Problems Connecting to MSSQL 2012
Posted: 11. December 2015 14:45
Hi Everyone,
I'm very excited about this joining this group.
I've been tasked to create a webpage to connect to our company database. I have a working knowledge of PHP and have connected to mySQL in the past. This is what I've done thus far:
~successfully install Xampp v 3.2.2.2 control panel and have Apache, MySQL, FileZilla and Mecury running on a Widows 8 computer.
~downloaded and installed php_pdo_sqlsrv_56_ts.dll php_sqlsrv_56_ts.dll from the Microsoft website into the C:\xampp\php\ext
~Added extension=php_pdo_sqlsrv_56_ts.dll and extension=php_sqlsrv_56_ts.dll to the PHP.ini file
I created a PHP file with this code:
and this code:
and both returned:
I checked the ODBC Data Source Administrator (64-bit) and under the Drivers Tab there is an entry Name: SQL Server Version 6.03.9600317415 Company: Microsoft Corporation File: SQLSRV32.DLL Date: 11/21/2014
Any advice is appreciated.
Thanks,
I'm very excited about this joining this group.
I've been tasked to create a webpage to connect to our company database. I have a working knowledge of PHP and have connected to mySQL in the past. This is what I've done thus far:
~successfully install Xampp v 3.2.2.2 control panel and have Apache, MySQL, FileZilla and Mecury running on a Widows 8 computer.
~downloaded and installed php_pdo_sqlsrv_56_ts.dll php_sqlsrv_56_ts.dll from the Microsoft website into the C:\xampp\php\ext
~Added extension=php_pdo_sqlsrv_56_ts.dll and extension=php_sqlsrv_56_ts.dll to the PHP.ini file
I created a PHP file with this code:
- Code: Select all
<?php
$serverName = "ONYX5";
$connectionInfo = array( "Database"=>"ONYXMAX5");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if ( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established. <br />";
die ( print_r( sqlsrv_errors(), true));
}
?>
and this code:
- Code: Select all
<?php
$serverName = "ONYX"; //serverName\instanceName
$connectionInfo = array( "Database"=>"ONYXMAX5", "UID"=>"test", "PWD"=>"test");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
and both returned:
Connection could not be established.
Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires the Microsoft ODBC Driver 11 for SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires the Microsoft ODBC Driver 11 for SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712 ) [1] => Array ( [0] => IM002 [SQLSTATE] => IM002 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified ) )
I checked the ODBC Data Source Administrator (64-bit) and under the Drivers Tab there is an entry Name: SQL Server Version 6.03.9600317415 Company: Microsoft Corporation File: SQLSRV32.DLL Date: 11/21/2014
Any advice is appreciated.
Thanks,