deluxephp15 Posted November 12, 2011 Share Posted November 12, 2011 I'm trying to connect to my SQL Server 2008 DB using the MS driver but I'm having some issues. Any ideas? Here is my test connection using Microsoft's driver <?php /* Specify the server and connection string attributes. */ $serverName = "(local)\SQLj"; /* Get UID and PWD from application-specific files. */ $uid = file_get_contents("D:\PHP\u.txt"); $pwd = file_get_contents("D:\PHP\ppp.txt"); $connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd, "Database"=>"AdventureWorks"); /* Connect using SQL Server Authentication. */ $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ) { echo "Unable to connect.</br>"; die( print_r( sqlsrv_errors(), true)); } /* Query SQL Server for the login of the user accessing the database. */ $tsql = "SELECT CONVERT(varchar(32), SUSER_SNAME())"; $stmt = sqlsrv_query( $conn, $tsql); if( $stmt === false ) { echo "Error in executing query.</br>"; die( print_r( sqlsrv_errors(), true)); } /* Retrieve and display the results of the query. */ $row = sqlsrv_fetch_array($stmt); echo "User login: ".$row[0]."</br>"; /* Free statement and connection resources. */ sqlsrv_free_stmt( $stmt); sqlsrv_close( $conn); ?> The error This extension requires the Microsoft SQL Server 2011 Native Client. Access the following URL to download the Microsoft SQL Server 2011 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires the Microsoft SQL Server 2011 Native Client. Access the following URL to download the Microsoft SQL Server 2011 Native Client ODBC driver 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 ) ) PHP Info results pdo_sqlsrv pdo_sqlsrv support enabled Directive Local Value Master Value pdo_sqlsrv.client_buffer_max_kb_size 10240 10240 pdo_sqlsrv.log_severity 0 0 Quote Link to comment https://forums.phpfreaks.com/topic/250974-php-installmssql-driver-issue/ Share on other sites More sharing options...
trq Posted November 12, 2011 Share Posted November 12, 2011 Have you tried going to the link in the error message? Quote Link to comment https://forums.phpfreaks.com/topic/250974-php-installmssql-driver-issue/#findComment-1287537 Share on other sites More sharing options...
deluxephp15 Posted November 12, 2011 Author Share Posted November 12, 2011 Have you tried going to the link in the error message? Yes I have. I did notice that the message wants be to download "Microsoft SQL Server 2011 Native Client ODBC driver for x86", but I am running 64bit Windows 7 and MSSQL Express Edition with Advanced Services (64-bit). The x86 driver wont install but the x64 package was already installed. Quote Link to comment https://forums.phpfreaks.com/topic/250974-php-installmssql-driver-issue/#findComment-1287629 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.