Thread: Problem to connect from host via JDBC ...

Problem to connect from host via JDBC ...

From
Date:

I configured the postgres DB to start with :
    /usr/bin/postmaster -o -i -D ${PGDATA}
which I manually start with the "-d 5 & "@ the end.

The "psql" commands works fine locally.

pg_hda.conf contains the following line :
# The same, over Unix-socket connections:
#
#  local  all     192.168.1.0     255.255.255.0   trust
 host   all     192.168.1.0     255.255.255.0   trust

Of course my network is 192.168.1.0 with a subnetmask of 255.255.255.0

Trying to connect from another machine via JDBC gives the following error :
"1109 [main] WARN org.test.JDBCPostgres.TestJDBCPostgres  - Message :
Connection refused. Check that the hostname and port is correct, and that
the postmaster is  running with the -i flag, which enables TCP/IP
networking."

Which is definitevely the case :
$ ps -ef | grep post
    postgres  6525  6456  0 14:40 pts/0    00:00:00
/usr/bin/postmaster -o -i -D /da

Does some one knows what is going wrong ?

Thomas,

--
Thomas SMETS
rue J. Wytsmanstraat 62
1050 Bruxelles
yahoo-id : smetsthomas






Re: Problem to connect from host via JDBC ...

From
"Dave Cramer"
Date:
Thomas,

Can you send me the results of netstat -nlp | grep 5432

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of tsmets@brutele.be
Sent: Tuesday, March 05, 2002 3:47 AM
To: pgsql jdbc
Subject: [JDBC] Problem to connect from host via JDBC ...




I configured the postgres DB to start with :
    /usr/bin/postmaster -o -i -D ${PGDATA}
which I manually start with the "-d 5 & "@ the end.

The "psql" commands works fine locally.

pg_hda.conf contains the following line :
# The same, over Unix-socket connections:
#
#  local  all     192.168.1.0     255.255.255.0   trust
 host   all     192.168.1.0     255.255.255.0   trust

Of course my network is 192.168.1.0 with a subnetmask of 255.255.255.0

Trying to connect from another machine via JDBC gives the following
error: "1109 [main] WARN org.test.JDBCPostgres.TestJDBCPostgres  -
Message: Connection refused. Check that the hostname and port is
correct, and that the postmaster is  running with the -i flag, which
enables TCP/IP networking."

Which is definitevely the case :
$ ps -ef | grep post
    postgres  6525  6456  0 14:40 pts/0    00:00:00
/usr/bin/postmaster -o -i -D /da

Does some one knows what is going wrong ?

Thomas,

--
Thomas SMETS
rue J. Wytsmanstraat 62
1050 Bruxelles
yahoo-id: smetsthomas






---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org



Re: Problem to connect from host via JDBC ...

From
Rouyre Frédéric
Date:
I already answered but I forgot to put the list in cc ...
This is the -o that causes the problem ... indeed, -i is taken as a backend
parameter, not a postmaster parameter. Removing the -o should do the trick


> -----Original Message-----
> From: Dave Cramer [mailto:Dave@micro-automation.net]
> Sent: Tuesday, March 05, 2002 2:22 PM
> To: tsmets@brutele.be; 'pgsql jdbc'
> Subject: Re: [JDBC] Problem to connect from host via JDBC ...
>
>
> Thomas,
>
> Can you send me the results of netstat -nlp | grep 5432
>
> Dave
>
> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of
> tsmets@brutele.be
> Sent: Tuesday, March 05, 2002 3:47 AM
> To: pgsql jdbc
> Subject: [JDBC] Problem to connect from host via JDBC ...
>
>
>
>
> I configured the postgres DB to start with :
>     /usr/bin/postmaster -o -i -D ${PGDATA}
> which I manually start with the "-d 5 & "@ the end.
>
> The "psql" commands works fine locally.
>
> pg_hda.conf contains the following line :
> # The same, over Unix-socket connections:
> #
> #  local  all     192.168.1.0     255.255.255.0   trust
>  host   all     192.168.1.0     255.255.255.0   trust
>
> Of course my network is 192.168.1.0 with a subnetmask of 255.255.255.0
>
> Trying to connect from another machine via JDBC gives the following
> error: "1109 [main] WARN org.test.JDBCPostgres.TestJDBCPostgres  -
> Message: Connection refused. Check that the hostname and port is
> correct, and that the postmaster is  running with the -i flag, which
> enables TCP/IP networking."
>
> Which is definitevely the case :
> $ ps -ef | grep post
>     postgres  6525  6456  0 14:40 pts/0    00:00:00
> /usr/bin/postmaster -o -i -D /da
>
> Does some one knows what is going wrong ?
>
> Thomas,
>
> --
> Thomas SMETS
> rue J. Wytsmanstraat 62
> 1050 Bruxelles
> yahoo-id: smetsthomas
>
>
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>

Re: Problem to connect from host via JDBC ...

From
Tom Lane
Date:
<tsmets@brutele.be> writes:
> Trying to connect from another machine via JDBC gives the following error :
> "1109 [main] WARN org.test.JDBCPostgres.TestJDBCPostgres  - Message :
> Connection refused.

"Connection refused" suggests that the server machine's kernel is
rejecting the connection before it ever gets to the postmaster.  Check
to make sure you have the right hostname and port number specified.
Another possibility is a packet-filtering issue (though those usually
result in no response, rather than a connection-refused response).

            regards, tom lane

Re: Problem to connect from host via JDBC ...

From
Date:
Yes but if I  change it to

                su -l postgres -c '/usr/bin/pg_ctl  -D ${PGDATA} -p
/usr/bin/postmaster -i start' >/dev/null 2>&1

I doesn't start

Thomas,


--
Thomas SMETS
rue J. Wytsmanstraat 62
1050 Bruxelles
yahoo-id : smetsthomas

----- Original Message -----
From: "Rouyre Frédéric" <Frederic.Rouyre@osl.be>
To: "'pgsql jdbc'" <pgsql-jdbc@postgresql.org>
Sent: 05 March, 2002 3:35 PM
Subject: Re: [JDBC] Problem to connect from host via JDBC ...


> I already answered but I forgot to put the list in cc ...
> This is the -o that causes the problem ... indeed, -i is taken as a
backend
> parameter, not a postmaster parameter. Removing the -o should do the trick
>
>
> > -----Original Message-----
> > From: Dave Cramer [mailto:Dave@micro-automation.net]
> > Sent: Tuesday, March 05, 2002 2:22 PM
> > To: tsmets@brutele.be; 'pgsql jdbc'
> > Subject: Re: [JDBC] Problem to connect from host via JDBC ...
> >
> >
> > Thomas,
> >
> > Can you send me the results of netstat -nlp | grep 5432
> >
> > Dave
> >
> > -----Original Message-----
> > From: pgsql-jdbc-owner@postgresql.org
> > [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of
> > tsmets@brutele.be
> > Sent: Tuesday, March 05, 2002 3:47 AM
> > To: pgsql jdbc
> > Subject: [JDBC] Problem to connect from host via JDBC ...
> >
> >
> >
> >
> > I configured the postgres DB to start with :
> >     /usr/bin/postmaster -o -i -D ${PGDATA}
> > which I manually start with the "-d 5 & "@ the end.
> >
> > The "psql" commands works fine locally.
> >
> > pg_hda.conf contains the following line :
> > # The same, over Unix-socket connections:
> > #
> > #  local  all     192.168.1.0     255.255.255.0   trust
> >  host   all     192.168.1.0     255.255.255.0   trust
> >
> > Of course my network is 192.168.1.0 with a subnetmask of 255.255.255.0
> >
> > Trying to connect from another machine via JDBC gives the following
> > error: "1109 [main] WARN org.test.JDBCPostgres.TestJDBCPostgres  -
> > Message: Connection refused. Check that the hostname and port is
> > correct, and that the postmaster is  running with the -i flag, which
> > enables TCP/IP networking."
> >
> > Which is definitevely the case :
> > $ ps -ef | grep post
> >     postgres  6525  6456  0 14:40 pts/0    00:00:00
> > /usr/bin/postmaster -o -i -D /da
> >
> > Does some one knows what is going wrong ?
> >
> > Thomas,
> >
> > --
> > Thomas SMETS
> > rue J. Wytsmanstraat 62
> > 1050 Bruxelles
> > yahoo-id: smetsthomas
> >
> >
> >
> >
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to
> > majordomo@postgresql.org
> >
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to
> > majordomo@postgresql.org
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>




Re: Problem to connect from host via JDBC ...

From
Date:

AFAIK
there's no such network policy as I was able to connect to the machine via
HTTP when apache was turned on

Thomas,


--
Thomas SMETS
rue J. Wytsmanstraat 62
1050 Bruxelles
yahoo-id : smetsthomas
----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: <tsmets@brutele.be>
Cc: "pgsql jdbc" <pgsql-jdbc@postgresql.org>
Sent: 05 March, 2002 5:00 PM
Subject: Re: [JDBC] Problem to connect from host via JDBC ...


> <tsmets@brutele.be> writes:
> > Trying to connect from another machine via JDBC gives the following
error :
> > "1109 [main] WARN org.test.JDBCPostgres.TestJDBCPostgres  - Message :
> > Connection refused.
>
> "Connection refused" suggests that the server machine's kernel is
> rejecting the connection before it ever gets to the postmaster.  Check
> to make sure you have the right hostname and port number specified.
> Another possibility is a packet-filtering issue (though those usually
> result in no response, rather than a connection-refused response).
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>



Re: Problem to connect from host via JDBC ...

From
Date:

I tried to remove the -o but it was not successfull :-(
I then tried to move the -i forward in the argument line but it was also a
failure... :-(
This is the command executed by the call to
                /etc/init.d/postgresql start

                su -l postgres -c '/usr/bin/pg_ctl  -D ${PGDATA} -p
/usr/bin/postmaster -o -i start' >/dev/null 2>&1
                                                            -->  Success
    but any other solution, like :
                su -l postgres -c '/usr/bin/pg_ctl -i -D ${PGDATA} -p
/usr/bin/postmaster -o start' >/dev/null 2>&1
                                                            -->  Failed
                su -l postgres -c '/usr/bin/pg_ctl  -i -D ${PGDATA} -p
/usr/bin/postmaster -o start' >/dev/null 2>&1
                                                            -->  Failed
                su -l postgres -c '/usr/bin/pg_ctl -D ${PGDATA} -p
/usr/bin/postmaster -i -o start' >/dev/null 2>&1
                                                            --> Failed
                su -l postgres -c '/usr/bin/pg_ctl  -D ${PGDATA} -i -p
/usr/bin/postmaster -o start' >/dev/null 2>&1
                                                            -->  Failed

Some has a wilde / wise guess for me ?

Thomas,

--
Thomas SMETS
rue J. Wytsmanstraat 62
1050 Bruxelles
yahoo-id : smetsthomas
----- Original Message -----
From: "Rouyre Frédéric" <Frederic.Rouyre@osl.be>
To: "'pgsql jdbc'" <pgsql-jdbc@postgresql.org>
Sent: 05 March, 2002 3:35 PM
Subject: Re: [JDBC] Problem to connect from host via JDBC ...


> I already answered but I forgot to put the list in cc ...
> This is the -o that causes the problem ... indeed, -i is taken as a
backend
> parameter, not a postmaster parameter. Removing the -o should do the trick
>
>
> > -----Original Message-----
> > From: Dave Cramer [mailto:Dave@micro-automation.net]
> > Sent: Tuesday, March 05, 2002 2:22 PM
> > To: tsmets@brutele.be; 'pgsql jdbc'
> > Subject: Re: [JDBC] Problem to connect from host via JDBC ...
> >
> >
> > Thomas,
> >
> > Can you send me the results of netstat -nlp | grep 5432
> >
> > Dave
> >
> > -----Original Message-----
> > From: pgsql-jdbc-owner@postgresql.org
> > [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of
> > tsmets@brutele.be
> > Sent: Tuesday, March 05, 2002 3:47 AM
> > To: pgsql jdbc
> > Subject: [JDBC] Problem to connect from host via JDBC ...
> >
> >
> >
> >
> > I configured the postgres DB to start with :
> >     /usr/bin/postmaster -o -i -D ${PGDATA}
> > which I manually start with the "-d 5 & "@ the end.
> >
> > The "psql" commands works fine locally.
> >
> > pg_hda.conf contains the following line :
> > # The same, over Unix-socket connections:
> > #
> > #  local  all     192.168.1.0     255.255.255.0   trust
> >  host   all     192.168.1.0     255.255.255.0   trust
> >
> > Of course my network is 192.168.1.0 with a subnetmask of 255.255.255.0
> >
> > Trying to connect from another machine via JDBC gives the following
> > error: "1109 [main] WARN org.test.JDBCPostgres.TestJDBCPostgres  -
> > Message: Connection refused. Check that the hostname and port is
> > correct, and that the postmaster is  running with the -i flag, which
> > enables TCP/IP networking."
> >
> > Which is definitevely the case :
> > $ ps -ef | grep post
> >     postgres  6525  6456  0 14:40 pts/0    00:00:00
> > /usr/bin/postmaster -o -i -D /da
> >
> > Does some one knows what is going wrong ?
> >
> > Thomas,
> >
> > --
> > Thomas SMETS
> > rue J. Wytsmanstraat 62
> > 1050 Bruxelles
> > yahoo-id: smetsthomas
> >
> >
> >
> >
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to
> > majordomo@postgresql.org
> >
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to
> > majordomo@postgresql.org
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>



Re: Problem to connect from host via JDBC ...

From
"Nick Fankhauser"
Date:
Thomas-

The port is different from http. If you have psql installed on you machine,
a simple test would be to type:

psql -h<hostname> <database name>

If you can connect and run a few quesries, then you know that the host
machine is accepting connections.

-Nick

> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of tsmets@brutele.be
> Sent: Tuesday, March 05, 2002 1:43 PM
> To: Tom Lane; pgsql jdbc
> Subject: Re: [JDBC] Problem to connect from host via JDBC ...
>
>
>
>
> AFAIK
> there's no such network policy as I was able to connect to the machine via
> HTTP when apache was turned on
>
> Thomas,
>
>
> --
> Thomas SMETS
> rue J. Wytsmanstraat 62
> 1050 Bruxelles
> yahoo-id : smetsthomas
> ----- Original Message -----
> From: "Tom Lane" <tgl@sss.pgh.pa.us>
> To: <tsmets@brutele.be>
> Cc: "pgsql jdbc" <pgsql-jdbc@postgresql.org>
> Sent: 05 March, 2002 5:00 PM
> Subject: Re: [JDBC] Problem to connect from host via JDBC ...
>
>
> > <tsmets@brutele.be> writes:
> > > Trying to connect from another machine via JDBC gives the following
> error :
> > > "1109 [main] WARN org.test.JDBCPostgres.TestJDBCPostgres  - Message :
> > > Connection refused.
> >
> > "Connection refused" suggests that the server machine's kernel is
> > rejecting the connection before it ever gets to the postmaster.  Check
> > to make sure you have the right hostname and port number specified.
> > Another possibility is a packet-filtering issue (though those usually
> > result in no response, rather than a connection-refused response).
> >
> > regards, tom lane
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>


Re: Problem to connect from host via JDBC ...

From
"Dave Cramer"
Date:
Thomas

You need to replace the outside single quotes with double quotes and
then single quote the -o '-i'

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of tsmets@brutele.be
Sent: Tuesday, March 05, 2002 1:40 PM
To: Rouyre Frédéric; 'pgsql jdbc'
Subject: Re: [JDBC] Problem to connect from host via JDBC ...




I tried to remove the -o but it was not successfull :-(
I then tried to move the -i forward in the argument line but it was also
a failure...:-( This is the command executed by the call to
                /etc/init.d/postgresql start

                su -l postgres -c '/usr/bin/pg_ctl  -D ${PGDATA} -p
/usr/bin/postmaster -o -i start' >/dev/null 2>&1
                                                            -->  Success
    but any other solution, like :
                su -l postgres -c '/usr/bin/pg_ctl -i -D ${PGDATA} -p
/usr/bin/postmaster -o start' >/dev/null 2>&1
                                                            -->  Failed
                su -l postgres -c '/usr/bin/pg_ctl  -i -D ${PGDATA} -p
/usr/bin/postmaster -o start' >/dev/null 2>&1
                                                            -->  Failed
                su -l postgres -c '/usr/bin/pg_ctl -D ${PGDATA} -p
/usr/bin/postmaster -i -o start' >/dev/null 2>&1
                                                            --> Failed
                su -l postgres -c '/usr/bin/pg_ctl  -D ${PGDATA} -i -p
/usr/bin/postmaster -o start' >/dev/null 2>&1
                                                            -->  Failed

Some has a wilde / wise guess for me ?

Thomas,

--
Thomas SMETS
rue J. Wytsmanstraat 62
1050 Bruxelles
yahoo-id: smetsthomas
----- Original Message -----
From: "Rouyre Frédéric" <Frederic.Rouyre@osl.be>
To: "'pgsql jdbc'" <pgsql-jdbc@postgresql.org>
Sent: 05 March, 2002 3:35 PM
Subject: Re: [JDBC] Problem to connect from host via JDBC ...


> I already answered but I forgot to put the list in cc ... This is the
> -o that causes the problem ... indeed, -i is taken as a
backend
> parameter, not a postmaster parameter. Removing the -o should do the
> trick
>
>
> > -----Original Message-----
> > From: Dave Cramer [mailto:Dave@micro-automation.net]
> > Sent: Tuesday, March 05, 2002 2:22 PM
> > To: tsmets@brutele.be; 'pgsql jdbc'
> > Subject: Re: [JDBC] Problem to connect from host via JDBC ...
> >
> >
> > Thomas,
> >
> > Can you send me the results of netstat -nlp | grep 5432
> >
> > Dave
> >
> > -----Original Message-----
> > From: pgsql-jdbc-owner@postgresql.org
> > [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of
> > tsmets@brutele.be
> > Sent: Tuesday, March 05, 2002 3:47 AM
> > To: pgsql jdbc
> > Subject: [JDBC] Problem to connect from host via JDBC ...
> >
> >
> >
> >
> > I configured the postgres DB to start with :
> >     /usr/bin/postmaster -o -i -D ${PGDATA}
> > which I manually start with the "-d 5 & "@ the end.
> >
> > The "psql" commands works fine locally.
> >
> > pg_hda.conf contains the following line :
> > # The same, over Unix-socket connections:
> > #
> > #  local  all     192.168.1.0     255.255.255.0   trust
> >  host   all     192.168.1.0     255.255.255.0   trust
> >
> > Of course my network is 192.168.1.0 with a subnetmask of
> > 255.255.255.0
> >
> > Trying to connect from another machine via JDBC gives the following
> > error: "1109 [main] WARN org.test.JDBCPostgres.TestJDBCPostgres  -
> > Message: Connection refused. Check that the hostname and port is
> > correct, and that the postmaster is  running with the -i flag, which

> > enables TCP/IP networking."
> >
> > Which is definitevely the case :
> > $ ps -ef | grep post
> >     postgres  6525  6456  0 14:40 pts/0    00:00:00
> > /usr/bin/postmaster -o -i -D /da
> >
> > Does some one knows what is going wrong ?
> >
> > Thomas,
> >
> > --
> > Thomas SMETS
> > rue J. Wytsmanstraat 62
> > 1050 Bruxelles
> > yahoo-id: smetsthomas
> >
> >
> >
> >
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to
> > majordomo@postgresql.org
> >
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to
> > majordomo@postgresql.org
> >
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: Problem to connect from host via JDBC ...

From
"Nick Fankhauser"
Date:
> > psql -h<hostname> <database name>
> >
>
> That work of course.

OK, so we know the DB is accepting connections- that's progress...


This URL doesn't look quite right to me.

>       conn = DriverManager.getConnection(
> "jdbc:postgresql:company:@192.168.1.103:5432",
>                                          "postgres",
>                                          ""       );

assuming the database name is "company" Try changing this to:

       conn = DriverManager.getConnection(
 "jdbc:postgresql://192.168.1.103/company",
                                          "postgres",
                                          ""       );

-NickF


Re: Problem to connect from host via JDBC ...

From
Date:
That works
That's How I pollutate the DB ?

Thomas,

--
Thomas SMETS
rue J. Wytsmanstraat 62
1050 Bruxelles
yahoo-id : smetsthomas
----- Original Message -----
From: "Nick Fankhauser" <nickf@ontko.com>
To: <tsmets@brutele.be>; "Tom Lane" <tgl@sss.pgh.pa.us>; "pgsql jdbc"
<pgsql-jdbc@postgresql.org>
Sent: 05 March, 2002 8:02 PM
Subject: Re: [JDBC] Problem to connect from host via JDBC ...


> Thomas-
>
> The port is different from http. If you have psql installed on you
machine,
> a simple test would be to type:
>
> psql -h<hostname> <database name>
>
> If you can connect and run a few quesries, then you know that the host
> machine is accepting connections.
>
> -Nick
>
> > -----Original Message-----
> > From: pgsql-jdbc-owner@postgresql.org
> > [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of tsmets@brutele.be
> > Sent: Tuesday, March 05, 2002 1:43 PM
> > To: Tom Lane; pgsql jdbc
> > Subject: Re: [JDBC] Problem to connect from host via JDBC ...
> >
> >
> >
> >
> > AFAIK
> > there's no such network policy as I was able to connect to the machine
via
> > HTTP when apache was turned on
> >
> > Thomas,
> >
> >
> > --
> > Thomas SMETS
> > rue J. Wytsmanstraat 62
> > 1050 Bruxelles
> > yahoo-id : smetsthomas
> > ----- Original Message -----
> > From: "Tom Lane" <tgl@sss.pgh.pa.us>
> > To: <tsmets@brutele.be>
> > Cc: "pgsql jdbc" <pgsql-jdbc@postgresql.org>
> > Sent: 05 March, 2002 5:00 PM
> > Subject: Re: [JDBC] Problem to connect from host via JDBC ...
> >
> >
> > > <tsmets@brutele.be> writes:
> > > > Trying to connect from another machine via JDBC gives the following
> > error :
> > > > "1109 [main] WARN org.test.JDBCPostgres.TestJDBCPostgres  - Message
:
> > > > Connection refused.
> > >
> > > "Connection refused" suggests that the server machine's kernel is
> > > rejecting the connection before it ever gets to the postmaster.  Check
> > > to make sure you have the right hostname and port number specified.
> > > Another possibility is a packet-filtering issue (though those usually
> > > result in no response, rather than a connection-refused response).
> > >
> > > regards, tom lane
> > >
> > > ---------------------------(end of
broadcast)---------------------------
> > > TIP 2: you can get off all lists at once with the unregister command
> > >     (send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)
> > >
> >
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>



Re: Problem to connect from host via JDBC ...

From
Rouyre Frédéric
Date:
I dit not see that the postmaster was executed by pg_ctl so removing the -o
will NOT do the trick, indeed.

Make a simple test, try to load postgres with

su -l postgres '/usr/bin/postmaster -S -i'

If you are not able to connect the db (through socket) after this command,
then there is another problem, not linked with the way you are executing
pg_ctl.

Let me know the results...

> -----Original Message-----
> From: tsmets@brutele.be [mailto:tsmets@brutele.be]
> Sent: Tuesday, March 05, 2002 7:40 PM
> To: Rouyre Frédéric; 'pgsql jdbc'
> Subject: Re: [JDBC] Problem to connect from host via JDBC ...
>
>
>
>
> I tried to remove the -o but it was not successfull :-(
> I then tried to move the -i forward in the argument line but
> it was also a
> failure... :-(
> This is the command executed by the call to
>                 /etc/init.d/postgresql start
>
>                 su -l postgres -c '/usr/bin/pg_ctl  -D ${PGDATA} -p
> /usr/bin/postmaster -o -i start' >/dev/null 2>&1
>
> -->  Success
>     but any other solution, like :
>                 su -l postgres -c '/usr/bin/pg_ctl -i -D ${PGDATA} -p
> /usr/bin/postmaster -o start' >/dev/null 2>&1
>
> -->  Failed
>                 su -l postgres -c '/usr/bin/pg_ctl  -i -D ${PGDATA} -p
> /usr/bin/postmaster -o start' >/dev/null 2>&1
>
> -->  Failed
>                 su -l postgres -c '/usr/bin/pg_ctl -D ${PGDATA} -p
> /usr/bin/postmaster -i -o start' >/dev/null 2>&1
>                                                             --> Failed
>                 su -l postgres -c '/usr/bin/pg_ctl  -D ${PGDATA} -i -p
> /usr/bin/postmaster -o start' >/dev/null 2>&1
>
> -->  Failed
>
> Some has a wilde / wise guess for me ?
>
> Thomas,
>
> --
> Thomas SMETS
> rue J. Wytsmanstraat 62
> 1050 Bruxelles
> yahoo-id : smetsthomas
> ----- Original Message -----
> From: "Rouyre Frédéric" <Frederic.Rouyre@osl.be>
> To: "'pgsql jdbc'" <pgsql-jdbc@postgresql.org>
> Sent: 05 March, 2002 3:35 PM
> Subject: Re: [JDBC] Problem to connect from host via JDBC ...
>
>
> > I already answered but I forgot to put the list in cc ...
> > This is the -o that causes the problem ... indeed, -i is taken as a
> backend
> > parameter, not a postmaster parameter. Removing the -o
> should do the trick
> >
> >
> > > -----Original Message-----
> > > From: Dave Cramer [mailto:Dave@micro-automation.net]
> > > Sent: Tuesday, March 05, 2002 2:22 PM
> > > To: tsmets@brutele.be; 'pgsql jdbc'
> > > Subject: Re: [JDBC] Problem to connect from host via JDBC ...
> > >
> > >
> > > Thomas,
> > >
> > > Can you send me the results of netstat -nlp | grep 5432
> > >
> > > Dave
> > >
> > > -----Original Message-----
> > > From: pgsql-jdbc-owner@postgresql.org
> > > [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of
> > > tsmets@brutele.be
> > > Sent: Tuesday, March 05, 2002 3:47 AM
> > > To: pgsql jdbc
> > > Subject: [JDBC] Problem to connect from host via JDBC ...
> > >
> > >
> > >
> > >
> > > I configured the postgres DB to start with :
> > >     /usr/bin/postmaster -o -i -D ${PGDATA}
> > > which I manually start with the "-d 5 & "@ the end.
> > >
> > > The "psql" commands works fine locally.
> > >
> > > pg_hda.conf contains the following line :
> > > # The same, over Unix-socket connections:
> > > #
> > > #  local  all     192.168.1.0     255.255.255.0   trust
> > >  host   all     192.168.1.0     255.255.255.0   trust
> > >
> > > Of course my network is 192.168.1.0 with a subnetmask of
> 255.255.255.0
> > >
> > > Trying to connect from another machine via JDBC gives the
> following
> > > error: "1109 [main] WARN org.test.JDBCPostgres.TestJDBCPostgres  -
> > > Message: Connection refused. Check that the hostname and port is
> > > correct, and that the postmaster is  running with the -i
> flag, which
> > > enables TCP/IP networking."
> > >
> > > Which is definitevely the case :
> > > $ ps -ef | grep post
> > >     postgres  6525  6456  0 14:40 pts/0    00:00:00
> > > /usr/bin/postmaster -o -i -D /da
> > >
> > > Does some one knows what is going wrong ?
> > >
> > > Thomas,
> > >
> > > --
> > > Thomas SMETS
> > > rue J. Wytsmanstraat 62
> > > 1050 Bruxelles
> > > yahoo-id: smetsthomas
> > >
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------(end of
> > > broadcast)---------------------------
> > > TIP 1: subscribe and unsubscribe commands go to
> > > majordomo@postgresql.org
> > >
> > >
> > >
> > > ---------------------------(end of
> > > broadcast)---------------------------
> > > TIP 1: subscribe and unsubscribe commands go to
> > > majordomo@postgresql.org
> > >
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
> >
>
>

Re: Problem to connect from host via JDBC ...

From
Date:

Conclusion of all these is that the /etc/init.d/postresql start command
contains now :
    su -l postgres -c "/usr/bin/pg_ctl -D ${PGDATA} -p
/usr/bin/postmaster -o '-i' start" >/dev/null 2>&1

The JDBC url is now with the following structure :
        conn = DriverManager.getConnection( "jdbc:postgresql://" + <HOST> +
"/" + <DB_NAME>, <user>,  <pwd>  );

However & "contrary" to what is specified on Nick's site I did not need to
set the "tcpip_socket" to "1".
As the exerpt from the "postgresql.conf" shows here below :
<snip>
#
#       Connection Parameters
#
#tcpip_socket = false
#ssl = false

#max_connections = 32 # 1-1024

#port = 5432
#hostname_lookup = false
#show_source_port = false

#unix_socket_directory = ''
#unix_socket_group = ''
#unix_socket_permissions = 0777

#virtual_host = ''

#krb_server_keyfile = ''
</snip>

Will need to read more about that in the future :-))

Tx very much to the precious help !

Thomas,
Thomas,


--
Thomas SMETS
rue J. Wytsmanstraat 62
1050 Bruxelles
yahoo-id : smetsthomas
----- Original Message -----
From: <tsmets@brutele.be>
To: "pgsql jdbc" <pgsql-jdbc@postgresql.org>
Sent: 05 March, 2002 9:47 AM
Subject: [JDBC] Problem to connect from host via JDBC ...


>
>
> I configured the postgres DB to start with :
>     /usr/bin/postmaster -o -i -D ${PGDATA}
> which I manually start with the "-d 5 & "@ the end.
>
> The "psql" commands works fine locally.
>
> pg_hda.conf contains the following line :
> # The same, over Unix-socket connections:
> #
> #  local  all     192.168.1.0     255.255.255.0   trust
>  host   all     192.168.1.0     255.255.255.0   trust
>
> Of course my network is 192.168.1.0 with a subnetmask of 255.255.255.0
>
> Trying to connect from another machine via JDBC gives the following error
:
> "1109 [main] WARN org.test.JDBCPostgres.TestJDBCPostgres  - Message :
> Connection refused. Check that the hostname and port is correct, and that
> the postmaster is  running with the -i flag, which enables TCP/IP
> networking."
>
> Which is definitevely the case :
> $ ps -ef | grep post
>     postgres  6525  6456  0 14:40 pts/0    00:00:00
> /usr/bin/postmaster -o -i -D /da
>
> Does some one knows what is going wrong ?
>
> Thomas,
>
> --
> Thomas SMETS
> rue J. Wytsmanstraat 62
> 1050 Bruxelles
> yahoo-id : smetsthomas
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>