[英]Postgres ODBC: connection “actively refused”
I'm using SSH tunneling to connect from a Windows 7 machine to a remote Postgres database. 我正在使用SSH隧道从Windows 7计算机连接到远程Postgres数据库。
The tunnel works fine when I use pgAdmin to connect to the remote database. 当我使用pgAdmin连接到远程数据库时,隧道可以正常工作。 However, I haven't managed to set up an ODBC DSN to connect to the remote database.
但是,我还没有设置ODBC DSN来连接到远程数据库。
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." 我正在使用与pgAdmin相同的服务器地址/用户名/密码/端口/ ssl模式创建系统DSN,但是当我单击“测试”时,我得到:“无法连接到服务器;由于目标计算机处于活动状态,因此无法建立连接拒绝了。”
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.
我已经排除了Windows防火墙和远程服务器的配置,因为我可以在pgAdmin中使用完全相同的信息进行连接。
Edit 编辑
The problem resolved itself after reinstalling Windows. 重新安装Windows后,问题自行解决。
When debugging this the first thing to do is to start testing the PostgreSQL server with the psql command line utility. 调试时,首先要做的是开始使用psql命令行实用工具测试PostgreSQL服务器。 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). 现在,假设问题出在#2上,我要做的第一件事就是尝试在两边都禁用防火墙(可以在将两边都关闭后将其打开并进行调整)。 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. 以我的经验,Windows防火墙可能会引起各种问题。 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.
我认为您不能根据所提供的信息排除Windows防火墙。
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. 另一种可能是错误的ODBC配置(可能是端口5423而不是5432)或安装不好的某种DLL。 The latter may be fixed (or not) using
sfc /scannow
or reinstalling the odbc driver, or other actions. 可以使用
sfc /scannow
或重新安装odbc驱动程序或其他措施来修复(或不修复)后者。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.