我将SQL数据库连接到 PHP 网站(两者都在Azure上),
PHP中的所有内容似乎都很好,Connection String也很完美 当我尝试连接到数据库时,它会连接并执行所有操作,但是当我尝试连接到另一个数据库时,它会显示以下错误。
Array (
[0] => Array (
[0] => 08001
[SQLSTATE] => 08001
[1] => 5
[code] => 5
[2] => [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [5].
[message] => [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [5].
)
[1] => Array (
[0] => HYT00
[SQLSTATE] => HYT00
[1] => 0
[code] => 0
[2] => [Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired
[message] => [Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired
)
[2] => Array (
[0] => 08001
[SQLSTATE] => 08001
[1] => 5
[code] => 5
[2] => [Microsoft][ODBC Driver 11 for SQL Server]A network-related or
instance-specific error has occurred while establishing a
connection to SQL Server. Server is not found or not accessible.
Check if instance name is correct and if SQL Server is configured
to allow remote connections. For more information see SQL Server
Books Online.
[message] => [Microsoft][ODBC Driver 11 for SQL Server]A network-related
or instance-specific error has occurred while establishing a
connection to SQL Server. Server is not found or not accessible.
Check if instance name is correct and if SQL Server is configured to
allow remote connections. For more information see SQL Server Books
Online.
)
)
而且, 我在未连接的数据库上看到此锁定符号。
此锁定不会出现在成功连接的数据库中 此外,所有三个(两个数据库和一个Web应用程序)都位于相同资源组。
我使用应用程序设置上存储的连接字符串连接两个数据库。
答案 0 :(得分:2)
实际上,这是 TDE (透明数据加密)图标,而不是锁定符号。请参阅Transparent Data Encryption with Azure SQL Database。
根据上面的错误消息,此问题的最可能原因是您使用的服务器名称不正确。以下是一些解决此问题的建议: