Postgres ODBC:连接“主动拒绝”
我正在使用 SSH 隧道从 Windows 7 计算机连接到远程 Postgres 数据库。
当我使用 pgAdmin 连接到远程数据库时,隧道工作正常。但是,我还没有设法设置 ODBC DSN 来连接到远程数据库。
我正在创建一个与 pgAdmin 具有相同服务器地址/用户名/密码/端口/ssl 模式的系统 DSN,但是当我单击“测试”时,我得到:“无法连接到服务器;无法建立连接,因为目标计算机主动连接拒绝了。”
关于从哪里开始调试有什么想法吗?我已经排除了 Windows 防火墙和远程服务器配置,因为我可以使用 pgAdmin 中的完全相同的信息进行连接。
编辑
重新安装 Windows 后问题自行解决。
I'm using SSH tunneling to connect from a Windows 7 machine to a remote Postgres database.
The tunnel works fine when I use pgAdmin to connect to the remote database. However, I haven't managed to set up an ODBC DSN to connect to the remote database.
I'm creating a System DSN with the same server address/username/password/port/ssl mode as pgAdmin but when I click "Test" I get: "Could not connect to server; No connection could be made because the target machine actively refused it."
Any ideas on where to start debugging? I've ruled out Windows Firewall and remote server configuration, since I can connect with the exact same information in pgAdmin.
Edit
The problem resolved itself after reinstalling Windows.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
调试时,要做的第一件事是使用 psql 命令行实用程序开始测试 PostgreSQL 服务器。这避免了驱动程序等的问题,以了解实际发生的情况。一般来说,我的故障排除过程是:
现在,假设问题出在#2上,我要做的第一件事就是尝试禁用两侧的防火墙(在尝试关闭两者后可以启动并调整它们)。这排除了防火墙行为不当的情况,如果它表明这是一个问题,那么您就知道在哪里进行故障排除。
根据我的经验,Windows 防火墙可能会导致各种问题。我什至看到它在网页中途阻止网页。我认为您不能根据您提供的信息排除 Windows 防火墙的可能性。
如果这种情况再次发生,首先要做的就是禁用所有防病毒软件和防火墙。
另一种可能性是错误的 ODBC 配置(可能是端口 5423 而不是 5432)或某种错误安装的 DLL。后者可以使用 sfc /scannow 或重新安装 odbc 驱动程序或其他操作来修复(或不修复)。
When debugging this the first thing to do is to start testing the PostgreSQL server with the psql command line utility. This avoids issues of drivers etc to see what is actually going on. Generally speaking my troubleshooting process is:
Now, assuming the problem is on #2, the first thing I would do is try disabling firewalls on both sides (they can be brought up and tuned after trying with both down). This rules out misbehaving firewalls and if it shows this to be a problem then you have the answer on where to troubleshoot.
In my experience Windows firewall can cause all manner of problems. I have even seen it block web pages halfway through the web page. I don't think you can rule out Windows Firewall based on the information you have provided.
If this happens again, the first things to do include disabling both any antivirus software and firewalls.
The other possibility would be a bad ODBC config (maybe port 5423 instead of 5432) or a badly installed DLL of some sort. The latter may be fixed (or not) using
sfc /scannow
or reinstalling the odbc driver, or other actions.