Page 1 of 1

Database connection problem

Posted: Sun 29 May 2011 08:09
by AlexK
Trying to connect in TPgConnection to server I receive "Cannot connect to database. Socket error on connect. WSAGetLast Error return 10060($274C)".

Serve definition is suspected. Any ideas? What is the Error meaning?

Thank you in advance...

Posted: Mon 30 May 2011 09:00
by AlexP
Hello,

Please specify the following information:
the exact version of PgDAC;
the exact version of the PostgreSQL server;
the exact version of your IDE.

Also please check that you specified all connection parameters correctly and you can connect to the server with the help of any third-party components, for example, PgAdmin.

Posted: Mon 30 May 2011 12:05
by AlexK
Hi AlexP,

Thank you for your response.

Please, specify how I can get PgDAC and IDE version.

I use Delphi 6, build 6.240 and Postgre SQL 9.0 for win x64.

I succeed to connect to local server with Postgre SQL 9.0 x32 and hope that parameters for connection are correct.

Is it possible to get explanations for Errors?

Thank you in advance...

Posted: Mon 30 May 2011 13:27
by AlexP
Hello,

You can find the exact version of PgDAC at the About tab of the PgConnection component.
As I have already written, please check if you can connect to your PostgreSQL x64 server using the standard PgAdmin utility. If you can connect using PgAdmin, you should use the same settings in PgDAC. If you cannot connect, contact your database administrator and ask him what are the exact parameters for connecting to the remote server.

You can get the description of the error by executing the following code:

Code: Select all

ShowMessage(SysErrorMessage(ErrCode));
Where ErrCode is the error code (in your case it is 10060: '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')

Posted: Mon 30 May 2011 14:15
by AlexK
Hi AlexP,

I appreciate you immediate response!!! :D

I could not find About Tab on the Components, but the version of "pgdac60.bpl" is 2.20.0.6. (Sorry, sometimes I become stupid....)

Connection to Postgre SQL from the local PgAdmin is simple and successful.
The same parameters does not help from remote.
I suspect a problem in pg_hba.conf. I have the next:


# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
host all all 192.168.1.0/0 md5

and hope it work, but no....

Thank you for tip with "LastError" explanation...

Posted: Mon 30 May 2011 14:42
by AlexP
Hello,

Check that the following lines are defined in the file like:

in postgresql.conf

listen_addresses = '*'

in pg_hba.conf

# IPv4 local connections:
host all all 192.168.1.0/24 trust

Posted: Tue 31 May 2011 07:06
by AlexK
Hi Alex,

Unfortunately, it does not help.

Postgresql.conf contains the line required.
Line added to pg_hba.conf didn't change anything...

I'll try to talk with our Net Admin...

Is it possible to use some other postgre tools to try remote connection?

Thank you,
Alex.

Posted: Tue 31 May 2011 07:46
by AlexK
Hi Alex,

Maybe, the problem is that remote server is Windows 7 with Postgre SQL 9.0 for x64.
Client that I try to connect is 32 bit application from Windowa XP.

Are there any limitation between x-32 and x64 connections? Is it possible?

Now I'm installing Postgre server on the Windows XP computer for tests...

Posted: Tue 31 May 2011 08:45
by AlexK
Hi Alex,

Sorry, it's me again...
I installed Postgre SQL 32 bit on Windows XP. And created the same Server with DB as on local.
Attempt to connect follows message "Cannot connect to database no pg_hba.conf entry for host "192.168.0.150", user "xxx", database "yyy", SSL off". Server IP is 192.168.1.142..

Posted: Tue 31 May 2011 08:45
by AlexP
Hello,

To check connection to the PostgreSQL server, it's better to use the standard PgAdmin utility that is available in the PostgreSQL installation. You can also download it separately from the developers' site.

As PgDAC does not use the PostgreSQL client to work with server, OS capacity and version as well as those of PostgreSQL do not have any meaning.

PgDAC working capacity was tested on most OSs and PostgreSQL servers.

Posted: Tue 31 May 2011 09:49
by AlexK
Hi Alex,

Thank you for your response.
I already succeeded to connect remote Postgre SQL server on Windows XP. The problem was in pg_hba.conf...
Continue with Win 7 64 bit...

Thank you for support...

Posted: Mon 06 Jun 2011 19:51
by yapt
I connect fine to my Windows 7 with PostgreSQL 9.0 x64 from a Windows Vista client x32.

Greetings..

Posted: Thu 16 Jun 2011 09:56
by AlexK
It was firewall in local network domain. No problem between Windows XP and Windows XP, but error received during connection between Windows XP and Window 7 64 bit.

Posted: Tue 21 Jun 2011 08:37
by AlexP
Hello,

As PgDAC does not use PostgreSQL client for connecting and works with server directly through the network TCP/IP protocol, the problem seems to be connected with the firewall settings (some ports may be closed or access from definite addresses may be forbidden, etc). Try to turn the firewall off and connect to the PostgreSQL server once more.