Power BI Desktop连接DigitalOcean托管PostgreSQL只读节点失败求助
解决Power BI Desktop连接DigitalOcean PostgreSQL只读节点失败问题
问题概况
- 已通过pgAdmin4成功连接DigitalOcean托管的PostgreSQL只读节点,但Power BI Desktop连接失败
- 两者唯一差异:pgAdmin4可指定
SSL: required,初步判断这不是问题原因 - 服务器地址示例:
my-postgres-analytics-do-user-420-0.b.db.ondigitalocean.com - 目标数据库名称:
pool
Power BI报错信息
An error happened while reading data from the provider: 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'
操作与期望
- 操作:尝试用Power BI Desktop连接目标PostgreSQL数据库
- 期望:成功连接并读取数据库内容
排查与解决步骤
强制启用SSL连接
DigitalOcean托管的PostgreSQL节点默认要求SSL连接,Power BI的连接器可能未自动启用该配置。在Power BI连接界面的「高级选项」中,添加连接参数:sslmode=require,然后重试连接。检查端口与网络权限
- 确认Power BI使用的端口为PostgreSQL默认的
5432,若DigitalOcean端修改过端口需对应调整 - 检查本地防火墙、杀毒软件或代理是否阻止了5432端口的出站请求;同时确认DigitalOcean的数据库防火墙规则已将你的本地IP加入允许列表
- 确认Power BI使用的端口为PostgreSQL默认的
更新PostgreSQL驱动
确保安装了最新版的PostgreSQL ODBC驱动,旧版本驱动可能存在兼容性问题。安装完成后重启Power BI再尝试连接。使用连接字符串直接连接
跳过图形化配置界面,直接使用完整连接字符串建立连接:Server=my-postgres-analytics-do-user-420-0.b.db.ondigitalocean.com;Port=5432;Database=pool;Uid=你的用户名;Pwd=你的密码;sslmode=require;操作路径:Power BI > 获取数据 > 空白查询 > 从数据库 > 从PostgreSQL数据库 > 高级选项 > 输入上述连接字符串
内容的提问来源于stack exchange,提问作者Facundo Arias
相关产品推荐
相关产品推荐

