sqlsrv_connect:未找到数据源名称且未指定默认驱动程序

时间:2012-03-20 00:44:27

标签: php sql-server-2008 iis-7 sql-server-native-client

  • PHP Version 5.3.10
  • IIS版本7.5
  • SQL Express server 2008 r2
  • PHP扩展php_pdo_sqlsrv_53_ts.dll和php_sqlsrv_53_ts.dll。

问题是当我运行这个PHP代码时:

if (function_exists('sqlsrv_connect')) {  
    echo "Connection functions are available.\n";  
} else {  
    echo "Connection functions are not available.<br />\n";  
}  
$serverName = "TEST-DESKTOP\SQLEXPRESS";  
$connectionInfo = array( "Database"=>"DALEDB");  

// connection to the database  
$conn = sqlsrv_connect( $serverName, $connectionInfo);  
if( $conn === false )
{
    echo "Could not connect.<br />";
    die( print_r( sqlsrv_errors(), true));
}

我的输出是:

Connection functions are available
Could not connect

Array
(
    [0] => Array
    (
        [0] => IMSSP 
        [SQLSTATE] => IMSSP 
        [1] => -49 
        [code] => -49 
        [2] => 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
    )
) 

我已经拥有了2008 r2原生客户端,但我安装了2011客户端却没有成功,并且在过去的两天里一直停留在这一点上。如果有人能给我一些指示,我将不胜感激。

0 个答案:

没有答案