Thread: remote connection problem

remote connection problem

From
"Ilija Vidoevski"
Date:

I can not access to postgresql server 9.1.3 form client computer with front-end application written in MS Visual Foxpro 9 SP2.

 

Application made connection when work on PC where is postgresql server installed.

 

Connstr="DRIVER={PostgreSQL odbc driver(unicode)};server=localhost;Port=5432;Database=mydatabase; Uid=postgres;Pwd=mypwd;UseServerSidePrepare=1;MaxVarcharSize=254;UnknownsAsLongVarchar=0;TextAsLongVarchar=0;"

 

I installed ODBC driver v 09.00.0310-1 on client PC. Also firewall is disabled on server side.

 

This a settings in postgresql.conf file:

listen_addresses = '*'

 

This a settings in pg_hba.conf file:

# IPv4 local connections:

host     all       all       0.0.0.0/0         md5

# IPv6 local connections:

host     all       all       ::0/0    md5

 

I got this message:

Connectivity error: Could not connect to server;

No connection could be made because the target machine actively refused it (127.0.0.1:5432)

 

Any ideas what is wrong ?.

 

Thank’s

Ilija

 

Re: remote connection problem

From
Victor Hugo
Date:
Ilija,

Make a test change md5 to trust and see if you can connect.

Do not forget to restart the service


[]´s
Victor Hugo

2012/5/16 Ilija Vidoevski <ilija@fructal.com.mk>:
> I can not access to postgresql server 9.1.3 form client computer with
> front-end application written in MS Visual Foxpro 9 SP2.
>
>
>
> Application made connection when work on PC where is postgresql server
> installed.
>
>
>
> Connstr="DRIVER={PostgreSQL odbc
> driver(unicode)};server=localhost;Port=5432;Database=mydatabase;
> Uid=postgres;Pwd=mypwd;UseServerSidePrepare=1;MaxVarcharSize=254;UnknownsAsLongVarchar=0;TextAsLongVarchar=0;"
>
>
>
> I installed ODBC driver v 09.00.0310-1 on client PC. Also firewall is
> disabled on server side.
>
>
>
> This a settings in postgresql.conf file:
>
> listen_addresses = '*'
>
>
>
> This a settings in pg_hba.conf file:
>
> # IPv4 local connections:
>
> host     all       all       0.0.0.0/0         md5
>
> # IPv6 local connections:
>
> host     all       all       ::0/0    md5
>
>
>
> I got this message:
>
> Connectivity error: Could not connect to server;
>
> No connection could be made because the target machine actively refused it
> (127.0.0.1:5432)
>
>
>
> Any ideas what is wrong ?.
>
>
>
> Thank’s
>
> Ilija
>
>



--
[]´s
Victor Hugo

"Antes de imprimir, pense em sua responsabilidade e compromisso com o
MEIO AMBIENTE"

Re: remote connection problem

From
Jean MAURICE
Date:
I think you have to check the 32 / 64 bits system of the client and the server.
There is a problem with the 64bits ODBC but I can't remember what at this time
... but I can look for it.

I am an old VFP developper (beginning with FoxPro Dos in 1992). I am using
PostgreSql for less than one year. Beginning was difficult but now it works like
a charm.

Best Regards

--
Jean MAURICE
Grenoble - France - Europe
www.j-maurice.fr
www.atoutfox.org
www.aedtf.org

PS Victor Hugo : are you French ?


Re: remote connection problem

From
Michael Wood
Date:
Sorry for top posting. Replying from my phone and it does not allow
any other option. If I understand you correctly it works when you run
it on the same machine as the database server, but not when the client
is a different machine from the server? If that is the case then you
have specified the wrong host name in your connection string.
Localhost means "this machine". i.e. the machine that the client is
running on. So if you want to connect to another machine you must
specify that machine's name or address instead of localhost.

On 5/16/12, Ilija Vidoevski <ilija@fructal.com.mk> wrote:
> I can not access to postgresql server 9.1.3 form client computer with
> front-end application written in MS Visual Foxpro 9 SP2.
>
>
>
> Application made connection when work on PC where is postgresql server
> installed.
>
>
>
> Connstr="DRIVER={PostgreSQL odbc
> driver(unicode)};server=localhost;Port=5432;Database=mydatabase;
> Uid=postgres;Pwd=mypwd;UseServerSidePrepare=1;MaxVarcharSize=254;UnknownsAsL
> ongVarchar=0;TextAsLongVarchar=0;"
>
>
>
> I installed ODBC driver v 09.00.0310-1 on client PC. Also firewall is
> disabled on server side.
>
>
>
> This a settings in postgresql.conf file:
>
> listen_addresses = '*'
>
>
>
> This a settings in pg_hba.conf file:
>
> # IPv4 local connections:
>
> host     all       all       0.0.0.0/0         md5
>
> # IPv6 local connections:
>
> host     all       all       ::0/0    md5
>
>
>
> I got this message:
>
> Connectivity error: Could not connect to server;
>
> No connection could be made because the target machine actively refused it
> (127.0.0.1:5432)
>
>
>
> Any ideas what is wrong ?.
>
>
>
> Thank's
>
> Ilija
>
>
>
>


--
Michael Wood <esiotrot@gmail.com>

Re: remote connection problem

From
Michael Wood
Date:
Hi

On 17 May 2012 09:28, Ilija Vidoevski <ilija@fructal.com.mk> wrote:
> Thank's Michael.
>
> How can I be so blind. Connection is made.

Good.

> But speed through LAN is disaster.
> On the PC where postgresql server is installed, postgre is little slower
> then MS SqlSerever 2008 r2 express (same tables, same indexeses, same
> query).
>
> But when I run app on client PC retrieving data from server is very, very
> slow. On server PC report finish  for 2-3 sec, but on client PC about 1 min.
>
> On the server is also installed MS SqlSerever 2008 r2 express, and there is
> not great differences in speed to get data (from server or client PC). From
> server PC 1-2 sec and from client PC 2-4 sec.

Perhaps someone on the list will have an idea of why this might be.
I've copied the list in my reply.

> Ilija
> -----Original Message-----
> From: Michael Wood [mailto:esiotrot@gmail.com]
> Sent: Wednesday, May 16, 2012 11:26 PM
> To: Ilija Vidoevski; pgsql-novice@postgresql.org
> Subject: Re: [NOVICE] remote connection problem
>
> Sorry for top posting. Replying from my phone and it does not allow
> any other option. If I understand you correctly it works when you run
> it on the same machine as the database server, but not when the client
> is a different machine from the server? If that is the case then you
> have specified the wrong host name in your connection string.
> Localhost means "this machine". i.e. the machine that the client is
> running on. So if you want to connect to another machine you must
> specify that machine's name or address instead of localhost.
>
> On 5/16/12, Ilija Vidoevski <ilija@fructal.com.mk> wrote:
>> I can not access to postgresql server 9.1.3 form client computer with
>> front-end application written in MS Visual Foxpro 9 SP2.
>>
>>
>>
>> Application made connection when work on PC where is postgresql server
>> installed.
>>
>>
>>
>> Connstr="DRIVER={PostgreSQL odbc
>> driver(unicode)};server=localhost;Port=5432;Database=mydatabase;
>>
> Uid=postgres;Pwd=mypwd;UseServerSidePrepare=1;MaxVarcharSize=254;UnknownsAsL
>> ongVarchar=0;TextAsLongVarchar=0;"
>>
>>
>>
>> I installed ODBC driver v 09.00.0310-1 on client PC. Also firewall is
>> disabled on server side.
>>
>>
>>
>> This a settings in postgresql.conf file:
>>
>> listen_addresses = '*'
>>
>>
>>
>> This a settings in pg_hba.conf file:
>>
>> # IPv4 local connections:
>>
>> host     all       all       0.0.0.0/0         md5
>>
>> # IPv6 local connections:
>>
>> host     all       all       ::0/0    md5
>>
>> I got this message:
>>
>> Connectivity error: Could not connect to server;
>>
>> No connection could be made because the target machine actively refused it
>> (127.0.0.1:5432)
>>
>> Any ideas what is wrong ?.
>>
>> Thank's
>>
>> Ilija

--
Michael Wood <esiotrot@gmail.com>

Re: remote connection problem

From
"Ilija Vidoevski"
Date:

Thank's Michael.

 

How can I be so blind. Connection is made.

 

But speed through LAN is disaster.

On the PC where postgresql server is installed, postgre is little slower then MS SqlSerever 2008 r2 express (same tables, same indexeses, same query).

 

But when I run app on client PC retrieving data from server is very, very slow. On server PC report finish  for 2-3 sec, but on client PC about 1 min.

 

On the server is also installed MS SqlSerever 2008 r2 express, and there is not great differences in speed to get data (from server or client PC). From server PC 1-2 sec and from client PC 2-4 sec.

 

 

Ilija

 

Re: remote connection problem

From
Valentin Gjorgjioski
Date:
On 17.05.2012 11:27 Michael Wood wrote:
> Hi
>
> On 17 May 2012 09:28, Ilija Vidoevski<ilija@fructal.com.mk>  wrote:
>> Thank's Michael.
>>
>> How can I be so blind. Connection is made.
>
> Good.
>
>> But speed through LAN is disaster.
>> On the PC where postgresql server is installed, postgre is little slower
>> then MS SqlSerever 2008 r2 express (same tables, same indexeses, same
>> query).
>>
>> But when I run app on client PC retrieving data from server is very, very
>> slow. On server PC report finish  for 2-3 sec, but on client PC about 1 min.
>>
>> On the server is also installed MS SqlSerever 2008 r2 express, and there is
>> not great differences in speed to get data (from server or client PC). From
>> server PC 1-2 sec and from client PC 2-4 sec.
>
> Perhaps someone on the list will have an idea of why this might be.
> I've copied the list in my reply.

Probably has something with dns resolution of host name. Try to disable
that in postgres, or fix the dns on the server that resolves the client
name/ip.