无法使用Authentication = ActiveDirectoryPassword连接。找不到驱动器

时间:2018-12-28 17:39:36

标签: php sql-server

我有一个运行OS Windows Server 2012 R2的SQL Server。它正在运行Microsoft SQL Server 2012。

在另一台计算机上,我正在运行IIS Web服务器,并且已经安装了PHP版本7.2.13和Microsoft驱动程序5.3 for PHP for SQL Server。

我正在尝试通过PHP连接到SQL Server上的数据库:

<?php

// Now connect to an Azure SQL database by setting Authentication to ActiveDirectoryPassword
$azureServer = "vgissql";
$azureDatabase = "dbo.pctProjectTracking";
$azureUsername = "myuid";
$azurePassword = "mypassword";
$connectionInfo = "Database = $azureDatabase; Authentication = ActiveDirectoryPassword;";

try
{
    $conn = new PDO( "sqlsrv:server = $azureServer ; $connectionInfo", $azureUsername, $azurePassword );
    echo "Connected successfully with Authentication=ActiveDirectoryPassword.\n";
    $conn = null;
}
catch( PDOException $e )
{
    echo "Could not connect with Authentication=ActiveDirectoryPassword.\n";
    print_r( $e->getMessage() );
    echo "\n";
}

?>

如果我尝试在浏览器中打开此php文件,则会得到:

无法使用Authentication = ActiveDirectoryPassword连接。找不到驱动程序

关于这里可能出什么问题的任何想法?

0 个答案:

没有答案