【问题标题】:Why application in Azure Container Instance cannot connect to Azure SQL DB for PostgreSQL?为什么 Azure 容器实例中的应用程序无法连接到 Azure SQL DB for PostgreSQL?
【发布时间】:2021-12-28 20:39:46
【问题描述】:

我在 Azure 容器实例中有 Python 应用程序,它尝试建立与 Azure DB for PostgreSQL 的连接,但失败了。 Azure DB 防火墙对 Azure 服务开放。当应用程序从本地机器 docker 连接时,连接工作正常。

不知道是什么问题?

psql: error: FATAL:  password authentication failed for user "myuser"
'sales.Customers' table is unavailable - sleeping
* Could not resolve host: hslotp
* Closing connection 0
OTP is unavailable - sleeping

【问题讨论】:

标签: azure-sql-database azure-container-instances


【解决方案1】:

您是否检查了端口匹配,您可以从Troubleshoot connection issues to Azure Database for PostgreSQL 验证以下内容

确保您拥有最新的psycopg2 版本或至少高于2.8.0

此外,连接字符串应如下所示。确保从 Azure 门户获取服务器名称和登录详细信息。

postgresql://user:password@container_name:5432?sslmode=disable

参考:thon to connect and query data in Azure Database for PostgreSQL

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-28
    • 1970-01-01
    • 2018-09-24
    • 2013-11-27
    • 1970-01-01
    • 2021-12-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多