Thread: Connection Problem
Good morning, I don't know if I've done something really stupid or if I've stumbled on a bug. Run Debian on my laptop, version 2.6.32-3-686. Downloaded the PostgreSQL 9.0.1 source and compiled it following all the instructions. Downloaded the PGAdminIII 1.12 source plus heaps of .cpp files, compiled it. I can access the 9.0 database via psql or PGAdmin, view the database I created, display data in tables. (Not much to display at present but some rows exists in a couple of tables.) Downloaded the JDBC driver postgresql-9.0-801.jdbc4.jar, put it in my CLASSPATH, etc. Downloaded the latest version of ExecuteQuery, declared the new driver, created a connection to my 9.0 database using the new driver but unable to connect to the database. See stack trace attached. Postmaster is started with the -i option which I believe is the same as saying "listen_addresses='*'". Using jdk1.6. Wrote a mickey mouse java class (testdbconn) to see if I could access the database and read data from a table that has two rows. See attached. When it runs it displays the same SQL error code as ExecuteQuery -- 08001 -- which is the "can't connect error". The developer of ExecuteQuery is a former colleague of mine and a friend. We have been sending each other e-mails about this trying to suss out the problem. Obviously, I have installed something incorrectly OR there is something awry with java making the connection. psql and PGAdmin talk directly to the database without using a JDBC driver. Seeing as they are both functioning normally, what have I done to cause java to pull connect errors??? Any advice will be greatly appreciated. Cheers, Rob
Attachment
On 08/12/10 02:29, Rob Stone wrote: > Wrote a mickey mouse java class (testdbconn) to see if I could access > the database and read data from a table that has two rows. See attached. > When it runs it displays the same SQL error code as ExecuteQuery -- > 08001 -- which is the "can't connect error". You have a network configuration problem of some sort: > Caused by: java.net.SocketException: Network is unreachable (This isn't "connection refused", it's "I have no configured route to that address") Oliver
Hi Oliver, Thanks for the reply. Output from netstat shows port 5432 as being listened. Don't know what to try next. Sometimes when I shut down my laptop the "stop" messages are displayed. I noticed last night that pg_ctl could not find the postmaster.pid file, even though PGHOST and PGDATA variables are set. I'm starting it with the -i and -D options with -D pointing explicitly to the PGDATA path using the full path name. Could not finding a postmaster.pid file be linked in any way with my problem?? Cheers, Rob rob@roblaptop:~> netstat -ln --tcp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:58112 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:44739 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:6566 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:60135 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 ::1:631 :::* LISTEN tcp6 0 0 :::5432 :::* LISTEN tcp6 0 0 :::6566 :::* LISTEN tcp6 0 0 :::80 :::* LISTEN rob@roblaptop:~> On Wed, 2010-12-08 at 08:52 +1300, Oliver Jowett wrote: > On 08/12/10 02:29, Rob Stone wrote: > > > Wrote a mickey mouse java class (testdbconn) to see if I could access > > the database and read data from a table that has two rows. See attached. > > When it runs it displays the same SQL error code as ExecuteQuery -- > > 08001 -- which is the "can't connect error". > > You have a network configuration problem of some sort: > > > Caused by: java.net.SocketException: Network is unreachable > > (This isn't "connection refused", it's "I have no configured route to > that address") > > Oliver
Rob, Have you tried 127.0.0.1 instead of localhost ? It's not that it isn't listening, the problem is there is no route to localhost which seems strange on it's own. Dave On Thu, Dec 9, 2010 at 8:18 AM, Rob Stone <robstone@mira.net> wrote: > Hi Oliver, > > Thanks for the reply. > > Output from netstat shows port 5432 as being listened. Don't know what > to try next. > > Sometimes when I shut down my laptop the "stop" messages are displayed. > I noticed last night that pg_ctl could not find the postmaster.pid file, > even though PGHOST and PGDATA variables are set. I'm starting it with > the -i and -D options with -D pointing explicitly to the PGDATA path > using the full path name. Could not finding a postmaster.pid file be > linked in any way with my problem?? > > > Cheers, > Rob > > rob@roblaptop:~> netstat -ln --tcp > Active Internet connections (only servers) > Proto Recv-Q Send-Q Local Address Foreign Address > State > tcp 0 0 0.0.0.0:22 0.0.0.0:* > LISTEN > tcp 0 0 127.0.0.1:631 0.0.0.0:* > LISTEN > tcp 0 0 0.0.0.0:5432 0.0.0.0:* > LISTEN > tcp 0 0 0.0.0.0:58112 0.0.0.0:* > LISTEN > tcp 0 0 0.0.0.0:2049 0.0.0.0:* > LISTEN > tcp 0 0 0.0.0.0:44739 0.0.0.0:* > LISTEN > tcp 0 0 0.0.0.0:6566 0.0.0.0:* > LISTEN > tcp 0 0 0.0.0.0:60135 0.0.0.0:* > LISTEN > tcp 0 0 0.0.0.0:111 0.0.0.0:* > LISTEN > tcp6 0 0 :::22 :::* > LISTEN > tcp6 0 0 ::1:631 :::* > LISTEN > tcp6 0 0 :::5432 :::* > LISTEN > tcp6 0 0 :::6566 :::* > LISTEN > tcp6 0 0 :::80 :::* > LISTEN > rob@roblaptop:~> > > > > > On Wed, 2010-12-08 at 08:52 +1300, Oliver Jowett wrote: >> On 08/12/10 02:29, Rob Stone wrote: >> >> > Wrote a mickey mouse java class (testdbconn) to see if I could access >> > the database and read data from a table that has two rows. See attached. >> > When it runs it displays the same SQL error code as ExecuteQuery -- >> > 08001 -- which is the "can't connect error". >> >> You have a network configuration problem of some sort: >> >> > Caused by: java.net.SocketException: Network is unreachable >> >> (This isn't "connection refused", it's "I have no configured route to >> that address") >> >> Oliver > > > > -- > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc >
Hi, Check with netstat -atnp (it shows the process associated with port), but psql should be there. Do route -n to see routing traces, execute ifconfig next. But this can be kernel driver problem. Do you "shut down" laptop by closing it, I mean do you put it in sleep mode? Maybe you need to restart network interfaces instead. On my PC when I put it on sleep mode, SATA controller doesn't wakes up. Kind regards, Radek Smogura > Rob, > > Have you tried 127.0.0.1 instead of localhost ? It's not that it isn't > listening, the problem is there is no route to localhost which seems > strange on it's own. > > Dave > > On Thu, Dec 9, 2010 at 8:18 AM, Rob Stone <robstone@mira.net> wrote: >> Hi Oliver, >> >> Thanks for the reply. >> >> Output from netstat shows port 5432 as being listened. Don't know what >> to try next. >> >> Sometimes when I shut down my laptop the "stop" messages are displayed. >> I noticed last night that pg_ctl could not find the postmaster.pid file, >> even though PGHOST and PGDATA variables are set. I'm starting it with >> the -i and -D options with -D pointing explicitly to the PGDATA path >> using the full path name. Could not finding a postmaster.pid file be >> linked in any way with my problem?? >> >> >> Cheers, >> Rob >> >> rob@roblaptop:~> netstat -ln --tcp >> Active Internet connections (only servers) >> Proto Recv-Q Send-Q Local Address Foreign Address >> State >> tcp 0 0 0.0.0.0:22 0.0.0.0:* >> LISTEN >> tcp 0 0 127.0.0.1:631 0.0.0.0:* >> LISTEN >> tcp 0 0 0.0.0.0:5432 0.0.0.0:* >> LISTEN >> tcp 0 0 0.0.0.0:58112 0.0.0.0:* >> LISTEN >> tcp 0 0 0.0.0.0:2049 0.0.0.0:* >> LISTEN >> tcp 0 0 0.0.0.0:44739 0.0.0.0:* >> LISTEN >> tcp 0 0 0.0.0.0:6566 0.0.0.0:* >> LISTEN >> tcp 0 0 0.0.0.0:60135 0.0.0.0:* >> LISTEN >> tcp 0 0 0.0.0.0:111 0.0.0.0:* >> LISTEN >> tcp6 0 0 :::22 :::* >> LISTEN >> tcp6 0 0 ::1:631 :::* >> LISTEN >> tcp6 0 0 :::5432 :::* >> LISTEN >> tcp6 0 0 :::6566 :::* >> LISTEN >> tcp6 0 0 :::80 :::* >> LISTEN >> rob@roblaptop:~> >> >> >> >> >> On Wed, 2010-12-08 at 08:52 +1300, Oliver Jowett wrote: >>> On 08/12/10 02:29, Rob Stone wrote: >>> >>> > Wrote a mickey mouse java class (testdbconn) to see if I could access >>> > the database and read data from a table that has two rows. See attached. >>> > When it runs it displays the same SQL error code as ExecuteQuery -- >>> > 08001 -- which is the "can't connect error". >>> >>> You have a network configuration problem of some sort: >>> >>> > Caused by: java.net.SocketException: Network is unreachable >>> >>> (This isn't "connection refused", it's "I have no configured route to >>> that address") >>> >>> Oliver >> >> >> >> -- >> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgsql-jdbc >> > > -- > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc >
Hi Radek, Output from those commands attached. I always completely shutdown my laptop and pull the plug. So, it is doing a complete cold boot each time. When I try connecting to the database with ExecuteQuery, the same error is returned for both "localhost" and 127.0.0.1, when entering those values as the "host" on the connection dialogue. Via a browser, if I access http://localhost it returns the "It Work's!" output from apache. Thanks to everybody for your help. Cheers, Rob On Thu, 2010-12-09 at 15:43 -0500, Radosław Smogura wrote: > Hi, > > Check with netstat -atnp (it shows the process associated with port), > but psql should be there. > > Do route -n to see routing traces, execute ifconfig next. > > But this can be kernel driver problem. Do you "shut down" laptop by > closing it, I mean do you put it in sleep mode? Maybe you need to > restart network interfaces instead. > > On my PC when I put it on sleep mode, SATA controller doesn't wakes up. > > Kind regards, > Radek Smogura > > Rob, > > > > Have you tried 127.0.0.1 instead of localhost ? It's not that it isn't > > listening, the problem is there is no route to localhost which seems > > strange on it's own. > > > > Dave > > > > On Thu, Dec 9, 2010 at 8:18 AM, Rob Stone <robstone@mira.net> wrote: > >> Hi Oliver, > >> > >> Thanks for the reply. > >> > >> Output from netstat shows port 5432 as being listened. Don't know what > >> to try next. > >> > >> Sometimes when I shut down my laptop the "stop" messages are displayed. > >> I noticed last night that pg_ctl could not find the postmaster.pid file, > >> even though PGHOST and PGDATA variables are set. I'm starting it with > >> the -i and -D options with -D pointing explicitly to the PGDATA path > >> using the full path name. Could not finding a postmaster.pid file be > >> linked in any way with my problem?? > >> > >> > >> Cheers, > >> Rob > >> > >> rob@roblaptop:~> netstat -ln --tcp > >> Active Internet connections (only servers) > >> Proto Recv-Q Send-Q Local Address Foreign Address > >> State > >> tcp 0 0 0.0.0.0:22 0.0.0.0:* > >> LISTEN > >> tcp 0 0 127.0.0.1:631 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:5432 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:58112 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:2049 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:44739 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:6566 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:60135 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:111 0.0.0.0:* > >> LISTEN > >> tcp6 0 0 :::22 :::* > >> LISTEN > >> tcp6 0 0 ::1:631 :::* > >> LISTEN > >> tcp6 0 0 :::5432 :::* > >> LISTEN > >> tcp6 0 0 :::6566 :::* > >> LISTEN > >> tcp6 0 0 :::80 :::* > >> LISTEN > >> rob@roblaptop:~> > >> > >> > >> > >> > >> On Wed, 2010-12-08 at 08:52 +1300, Oliver Jowett wrote: > >>> On 08/12/10 02:29, Rob Stone wrote: > >>> > >>> > Wrote a mickey mouse java class (testdbconn) to see if I could access > >>> > the database and read data from a table that has two rows. See attached. > >>> > When it runs it displays the same SQL error code as ExecuteQuery -- > >>> > 08001 -- which is the "can't connect error". > >>> > >>> You have a network configuration problem of some sort: > >>> > >>> > Caused by: java.net.SocketException: Network is unreachable > >>> > >>> (This isn't "connection refused", it's "I have no configured route to > >>> that address") > >>> > >>> Oliver > >> > >> > >> > >> -- > >> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > >> To make changes to your subscription: > >> http://www.postgresql.org/mailpref/pgsql-jdbc > >> > > > > -- > > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > > To make changes to your subscription: > > http://www.postgresql.org/mailpref/pgsql-jdbc > > > >
Attachment
Rob, can you turn of IPV6 and retest this ? Yes, I'm grasping at straws. Dave On Thu, Dec 9, 2010 at 6:48 PM, Rob Stone <robstone@mira.net> wrote: > Hi Radek, > > Output from those commands attached. > > I always completely shutdown my laptop and pull the plug. So, it is > doing a complete cold boot each time. > > When I try connecting to the database with ExecuteQuery, the same error > is returned for both "localhost" and 127.0.0.1, when entering those > values as the "host" on the connection dialogue. > > Via a browser, if I access http://localhost it returns the "It Work's!" > output from apache. > > Thanks to everybody for your help. > > Cheers, > Rob > > > > On Thu, 2010-12-09 at 15:43 -0500, Radosław Smogura wrote: >> Hi, >> >> Check with netstat -atnp (it shows the process associated with port), >> but psql should be there. >> >> Do route -n to see routing traces, execute ifconfig next. >> >> But this can be kernel driver problem. Do you "shut down" laptop by >> closing it, I mean do you put it in sleep mode? Maybe you need to >> restart network interfaces instead. >> >> On my PC when I put it on sleep mode, SATA controller doesn't wakes up. >> >> Kind regards, >> Radek Smogura >> > Rob, >> > >> > Have you tried 127.0.0.1 instead of localhost ? It's not that it isn't >> > listening, the problem is there is no route to localhost which seems >> > strange on it's own. >> > >> > Dave >> > >> > On Thu, Dec 9, 2010 at 8:18 AM, Rob Stone <robstone@mira.net> wrote: >> >> Hi Oliver, >> >> >> >> Thanks for the reply. >> >> >> >> Output from netstat shows port 5432 as being listened. Don't know what >> >> to try next. >> >> >> >> Sometimes when I shut down my laptop the "stop" messages are displayed. >> >> I noticed last night that pg_ctl could not find the postmaster.pid file, >> >> even though PGHOST and PGDATA variables are set. I'm starting it with >> >> the -i and -D options with -D pointing explicitly to the PGDATA path >> >> using the full path name. Could not finding a postmaster.pid file be >> >> linked in any way with my problem?? >> >> >> >> >> >> Cheers, >> >> Rob >> >> >> >> rob@roblaptop:~> netstat -ln --tcp >> >> Active Internet connections (only servers) >> >> Proto Recv-Q Send-Q Local Address Foreign Address >> >> State >> >> tcp 0 0 0.0.0.0:22 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 127.0.0.1:631 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:5432 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:58112 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:2049 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:44739 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:6566 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:60135 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:111 0.0.0.0:* >> >> LISTEN >> >> tcp6 0 0 :::22 :::* >> >> LISTEN >> >> tcp6 0 0 ::1:631 :::* >> >> LISTEN >> >> tcp6 0 0 :::5432 :::* >> >> LISTEN >> >> tcp6 0 0 :::6566 :::* >> >> LISTEN >> >> tcp6 0 0 :::80 :::* >> >> LISTEN >> >> rob@roblaptop:~> >> >> >> >> >> >> >> >> >> >> On Wed, 2010-12-08 at 08:52 +1300, Oliver Jowett wrote: >> >>> On 08/12/10 02:29, Rob Stone wrote: >> >>> >> >>> > Wrote a mickey mouse java class (testdbconn) to see if I could access >> >>> > the database and read data from a table that has two rows. See attached. >> >>> > When it runs it displays the same SQL error code as ExecuteQuery -- >> >>> > 08001 -- which is the "can't connect error". >> >>> >> >>> You have a network configuration problem of some sort: >> >>> >> >>> > Caused by: java.net.SocketException: Network is unreachable >> >>> >> >>> (This isn't "connection refused", it's "I have no configured route to >> >>> that address") >> >>> >> >>> Oliver >> >> >> >> >> >> >> >> -- >> >> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) >> >> To make changes to your subscription: >> >> http://www.postgresql.org/mailpref/pgsql-jdbc >> >> >> > >> > -- >> > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) >> > To make changes to your subscription: >> > http://www.postgresql.org/mailpref/pgsql-jdbc >> > >> >> > >
Can you successfully connect to postgres using: psql -h localhost - or - psql -h 127.0.0.1 Rob Stone <robstone@mira.net> wrote: Hi Radek, Output from those commands attached. I always completely shutdown my laptop and pull the plug. So, it is doing a complete cold boot each time. When I try connecting to the database with ExecuteQuery, the same error is returned for both "localhost" and 127.0.0.1, when entering those values as the "host" on the connection dialogue. Via a browser, if I access http://localhost it returns the "It Work's!" output from apache. Thanks to everybody for your help. Cheers, Rob On Thu, 2010-12-09 at 15:43 -0500, Radosław Smogura wrote: > Hi, > > Check with netstat -atnp (it shows the process associated with port), > but psql should be there. > > Do route -n to see routing traces, execute ifconfig next. > > But this can be kernel driver problem. Do you "shut down" laptop by > closing it, I mean do you put it in sleep mode? Maybe you need to > restart network interfaces instead. > > On my PC when I put it on sleep mode, SATA controller doesn't wakes up. > > Kind regards, > Radek Smogura > > Rob, > > > > Have you tried 127.0.0.1 instead of localhost ? It's not that it isn't > > listening, the problem is there is no route to localhost which seems > > strange on it's own. > > > > Dave > > > > On Thu, Dec 9, 2010 at 8:18 AM, Rob Stone <robstone@mira.net> wrote: > >> Hi Oliver, > >> > >> Thanks for the reply. > >> > >> Output from netstat shows port 5432 as being listened. Don't know what > >> to try next. > >> > >> Sometimes when I shut down my laptop the "stop" messages are displayed. > >> I noticed last night that pg_ctl could not find the postmaster.pid file, > >> even though PGHOST and PGDATA variables are set. I'm starting it with > >> the -i and -D options with -D pointing explicitly to the PGDATA path > >> using the full path name. Could not finding a postmaster.pid file be > >> linked in any way with my problem?? > >> > >> > >> Cheers, > >> Rob > >> > >> rob@roblaptop:~> netstat -ln --tcp > >> Active Internet connections (only servers) > >> Proto Recv-Q Send-Q Local Address Foreign Address > >> State > >> tcp 0 0 0.0.0.0:22 0.0.0.0:* > >> LISTEN > >> tcp 0 0 127.0.0.1:631 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:5432 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:58112 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:2049 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:44739 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:6566 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:60135 0.0.0.0:* > >> LISTEN > >> tcp 0 0 0.0.0.0:111 0.0.0.0:* > >> LISTEN > >> tcp6 0 0 :::22 :::* > >> LISTEN > >> tcp6 0 0 ::1:631 :::* > >> LISTEN > >> tcp6 0 0 :::5432 :::* > >> LISTEN > >> tcp6 0 0 :::6566 :::* > >> LISTEN > >> tcp6 0 0 :::80 :::* > >> LISTEN > >> rob@roblaptop:~> > >> > >> > >> > >> > >> On Wed, 2010-12-08 at 08:52 +1300, Oliver Jowett wrote: > >>> On 08/12/10 02:29, Rob Stone wrote: > >>> > >>> > Wrote a mickey mouse java class (testdbconn) to see if I could access > >>> > the database and read data from a table that has two rows. See attached. > >>> > When it runs it displays the same SQL error code as ExecuteQuery -- > >>> > 08001 -- which is the "can't connect error". > >>> > >>> You have a network configuration problem of some sort: > >>> > >>> > Caused by: java.net.SocketException: Network is unreachable > >>> > >>> (This isn't "connection refused", it's "I have no configured route to > >>> that address") > >>> > >>> Oliver > >> > >> > >> > >> -- > >> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > >> To make changes to your subscription: > >> http://www.postgresql.org/mailpref/pgsql-jdbc > >> > > > > -- > > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > > To make changes to your subscription: > > http://www.postgresql.org/mailpref/pgsql-jdbc > > > >
Hi, maybe this is your problem http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560056 try to start your java class with -Djava.net.preferIPv4Stack=true regards Thomas Am 07.12.2010 14:29, schrieb Rob Stone: > Good morning, > > I don't know if I've done something really stupid or if I've stumbled on > a bug. > > Run Debian on my laptop, version 2.6.32-3-686. Downloaded the PostgreSQL > 9.0.1 source and compiled it following all the instructions. Downloaded > the PGAdminIII 1.12 source plus heaps of .cpp files, compiled it. I can > access the 9.0 database via psql or PGAdmin, view the database I > created, display data in tables. (Not much to display at present but > some rows exists in a couple of tables.) > > Downloaded the JDBC driver postgresql-9.0-801.jdbc4.jar, put it in my > CLASSPATH, etc. > > Downloaded the latest version of ExecuteQuery, declared the new driver, > created a connection to my 9.0 database using the new driver but unable > to connect to the database. See stack trace attached. > > Postmaster is started with the -i option which I believe is the same as > saying "listen_addresses='*'". > > Using jdk1.6. > > Wrote a mickey mouse java class (testdbconn) to see if I could access > the database and read data from a table that has two rows. See attached. > When it runs it displays the same SQL error code as ExecuteQuery -- > 08001 -- which is the "can't connect error". > > The developer of ExecuteQuery is a former colleague of mine and a > friend. We have been sending each other e-mails about this trying to > suss out the problem. > > Obviously, I have installed something incorrectly OR there is something > awry with java making the connection. psql and PGAdmin talk directly to > the database without using a JDBC driver. Seeing as they are both > functioning normally, what have I done to cause java to pull connect > errors??? > > Any advice will be greatly appreciated. > > Cheers, > Rob > > >
Hi, I think you have badly configured routing table, I don't see there loopback routing (lo device) You should have line like this (lo - ended, 3rd line). 217.118.24.64 0.0.0.0 255.255.255.192 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo 0.0.0.0 217.118.24.65 0.0.0.0 UG 0 0 0 eth0 I believe that you can connect to postmaster at IP 187.65.254.157 (if it's not your dynamic address). After calling route add -net 127.0.0.0 you should connect as well. Check if you started all network interfaces at boot. Linux distributions makes its different, you will need to call /etc/init.d/*.lo or ifup lo from command line. Eventually check /etc/sysconfig/network/ifcfg-lo there should be something like STARTMODE=onboot I really wonder how you connect to http://localhost if you don't have route to it. I hope this helps you. Kind regards, Radosław smogura http://softperience.eu Cytowanie Rob Stone <robstone@mira.net>: > Hi Radek, > > Output from those commands attached. > > I always completely shutdown my laptop and pull the plug. So, it is > doing a complete cold boot each time. > > When I try connecting to the database with ExecuteQuery, the same error > is returned for both "localhost" and 127.0.0.1, when entering those > values as the "host" on the connection dialogue. > > Via a browser, if I access http://localhost it returns the "It Work's!" > output from apache. > > Thanks to everybody for your help. > > Cheers, > Rob > > > > On Thu, 2010-12-09 at 15:43 -0500, Radosław Smogura wrote: >> Hi, >> >> Check with netstat -atnp (it shows the process associated with port), >> but psql should be there. >> >> Do route -n to see routing traces, execute ifconfig next. >> >> But this can be kernel driver problem. Do you "shut down" laptop by >> closing it, I mean do you put it in sleep mode? Maybe you need to >> restart network interfaces instead. >> >> On my PC when I put it on sleep mode, SATA controller doesn't wakes up. >> >> Kind regards, >> Radek Smogura >> > Rob, >> > >> > Have you tried 127.0.0.1 instead of localhost ? It's not that it isn't >> > listening, the problem is there is no route to localhost which seems >> > strange on it's own. >> > >> > Dave >> > >> > On Thu, Dec 9, 2010 at 8:18 AM, Rob Stone <robstone@mira.net> wrote: >> >> Hi Oliver, >> >> >> >> Thanks for the reply. >> >> >> >> Output from netstat shows port 5432 as being listened. Don't know what >> >> to try next. >> >> >> >> Sometimes when I shut down my laptop the "stop" messages are displayed. >> >> I noticed last night that pg_ctl could not find the postmaster.pid file, >> >> even though PGHOST and PGDATA variables are set. I'm starting it with >> >> the -i and -D options with -D pointing explicitly to the PGDATA path >> >> using the full path name. Could not finding a postmaster.pid file be >> >> linked in any way with my problem?? >> >> >> >> >> >> Cheers, >> >> Rob >> >> >> >> rob@roblaptop:~> netstat -ln --tcp >> >> Active Internet connections (only servers) >> >> Proto Recv-Q Send-Q Local Address Foreign Address >> >> State >> >> tcp 0 0 0.0.0.0:22 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 127.0.0.1:631 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:5432 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:58112 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:2049 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:44739 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:6566 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:60135 0.0.0.0:* >> >> LISTEN >> >> tcp 0 0 0.0.0.0:111 0.0.0.0:* >> >> LISTEN >> >> tcp6 0 0 :::22 :::* >> >> LISTEN >> >> tcp6 0 0 ::1:631 :::* >> >> LISTEN >> >> tcp6 0 0 :::5432 :::* >> >> LISTEN >> >> tcp6 0 0 :::6566 :::* >> >> LISTEN >> >> tcp6 0 0 :::80 :::* >> >> LISTEN >> >> rob@roblaptop:~> >> >> >> >> >> >> >> >> >> >> On Wed, 2010-12-08 at 08:52 +1300, Oliver Jowett wrote: >> >>> On 08/12/10 02:29, Rob Stone wrote: >> >>> >> >>> > Wrote a mickey mouse java class (testdbconn) to see if I could access >> >>> > the database and read data from a table that has two rows. >> See attached. >> >>> > When it runs it displays the same SQL error code as ExecuteQuery -- >> >>> > 08001 -- which is the "can't connect error". >> >>> >> >>> You have a network configuration problem of some sort: >> >>> >> >>> > Caused by: java.net.SocketException: Network is unreachable >> >>> >> >>> (This isn't "connection refused", it's "I have no configured route to >> >>> that address") >> >>> >> >>> Oliver >> >> >> >> >> >> >> >> -- >> >> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) >> >> To make changes to your subscription: >> >> http://www.postgresql.org/mailpref/pgsql-jdbc >> >> >> > >> > -- >> > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) >> > To make changes to your subscription: >> > http://www.postgresql.org/mailpref/pgsql-jdbc >> > >> >> > >
hi, you dont need a route for localhost access. his lo device is configured properly. if localhost resolves to 127.0.0.1 then access is ok. route is needed for ips inside localhost subnet (127.0.0.0/8) try: route del -net 127.0.0.0 netmask 255.0.0.0 ping localhost regards Thomas Am 10.12.2010 10:38, schrieb Radosław Smogura: > Hi, > > I think you have badly configured routing table, I don't see there > loopback routing (lo device) > You should have line like this (lo - ended, 3rd line). > > 217.118.24.64 0.0.0.0 255.255.255.192 U 0 0 0 eth0 > 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 > 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo > 0.0.0.0 217.118.24.65 0.0.0.0 UG 0 0 0 eth0 > > I believe that you can connect to postmaster at IP 187.65.254.157 (if > it's not your dynamic address). After calling > route add -net 127.0.0.0 > you should connect as well. > > Check if you started all network interfaces at boot. Linux > distributions makes its different, you will need to call > /etc/init.d/*.lo or ifup lo from command line. Eventually check > /etc/sysconfig/network/ifcfg-lo there should be something like > STARTMODE=onboot > > I really wonder how you connect to http://localhost if you don't have > route to it. I hope this helps you. > > Kind regards, > Radosław smogura > http://softperience.eu > Cytowanie Rob Stone <robstone@mira.net>: >
No worries, I'm sure you won't be the first. This will be searchable so hopefully it will help others. Dave On Fri, Dec 10, 2010 at 8:15 AM, Rob Stone <robstone@mira.net> wrote: > Hi Radoslaw, > > A Thomas Markus sent me a workaround. See below. > > --- > maybe this is your problem > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560056 > > try to start your java class with -Djava.net.preferIPv4Stack=true > --- > > Using the -D option running java works. > > Now to sort out my l0 issue!! > > > Thanks to everybody for your assistance. At first glance I thought it > was a JDBC issue and I'm sorry to have troubled you all when it is > related to something entirely different. > > Regards, > Rob > > > > On Fri, 2010-12-10 at 04:38 -0500, Radosław Smogura wrote: >> Hi, >> >> I think you have badly configured routing table, I don't see there >> loopback routing (lo device) >> You should have line like this (lo - ended, 3rd line). >> >> 217.118.24.64 0.0.0.0 255.255.255.192 U 0 0 0 eth0 >> 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 >> 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo >> 0.0.0.0 217.118.24.65 0.0.0.0 UG 0 0 0 eth0 >> >> I believe that you can connect to postmaster at IP 187.65.254.157 (if >> it's not your dynamic address). After calling >> route add -net 127.0.0.0 >> you should connect as well. >> >> Check if you started all network interfaces at boot. Linux >> distributions makes its different, you will need to call >> /etc/init.d/*.lo or ifup lo from command line. Eventually check >> /etc/sysconfig/network/ifcfg-lo there should be something like >> STARTMODE=onboot >> >> I really wonder how you connect to http://localhost if you don't have >> route to it. I hope this helps you. >> >> Kind regards, >> Radosław smogura >> http://softperience.eu >> Cytowanie Rob Stone <robstone@mira.net>: >> >> > Hi Radek, >> > >> > Output from those commands attached. >> > >> > I always completely shutdown my laptop and pull the plug. So, it is >> > doing a complete cold boot each time. >> > >> > When I try connecting to the database with ExecuteQuery, the same error >> > is returned for both "localhost" and 127.0.0.1, when entering those >> > values as the "host" on the connection dialogue. >> > >> > Via a browser, if I access http://localhost it returns the "It Work's!" >> > output from apache. >> > >> > Thanks to everybody for your help. >> > >> > Cheers, >> > Rob >> > >> > >> > >> > On Thu, 2010-12-09 at 15:43 -0500, Radosław Smogura wrote: >> >> Hi, >> >> >> >> Check with netstat -atnp (it shows the process associated with port), >> >> but psql should be there. >> >> >> >> Do route -n to see routing traces, execute ifconfig next. >> >> >> >> But this can be kernel driver problem. Do you "shut down" laptop by >> >> closing it, I mean do you put it in sleep mode? Maybe you need to >> >> restart network interfaces instead. >> >> >> >> On my PC when I put it on sleep mode, SATA controller doesn't wakes up. >> >> >> >> Kind regards, >> >> Radek Smogura >> >> > Rob, >> >> > >> >> > Have you tried 127.0.0.1 instead of localhost ? It's not that it isn't >> >> > listening, the problem is there is no route to localhost which seems >> >> > strange on it's own. >> >> > >> >> > Dave >> >> > >> >> > On Thu, Dec 9, 2010 at 8:18 AM, Rob Stone <robstone@mira.net> wrote: >> >> >> Hi Oliver, >> >> >> >> >> >> Thanks for the reply. >> >> >> >> >> >> Output from netstat shows port 5432 as being listened. Don't know what >> >> >> to try next. >> >> >> >> >> >> Sometimes when I shut down my laptop the "stop" messages are displayed. >> >> >> I noticed last night that pg_ctl could not find the postmaster.pid file, >> >> >> even though PGHOST and PGDATA variables are set. I'm starting it with >> >> >> the -i and -D options with -D pointing explicitly to the PGDATA path >> >> >> using the full path name. Could not finding a postmaster.pid file be >> >> >> linked in any way with my problem?? >> >> >> >> >> >> >> >> >> Cheers, >> >> >> Rob >> >> >> >> >> >> rob@roblaptop:~> netstat -ln --tcp >> >> >> Active Internet connections (only servers) >> >> >> Proto Recv-Q Send-Q Local Address Foreign Address >> >> >> State >> >> >> tcp 0 0 0.0.0.0:22 0.0.0.0:* >> >> >> LISTEN >> >> >> tcp 0 0 127.0.0.1:631 0.0.0.0:* >> >> >> LISTEN >> >> >> tcp 0 0 0.0.0.0:5432 0.0.0.0:* >> >> >> LISTEN >> >> >> tcp 0 0 0.0.0.0:58112 0.0.0.0:* >> >> >> LISTEN >> >> >> tcp 0 0 0.0.0.0:2049 0.0.0.0:* >> >> >> LISTEN >> >> >> tcp 0 0 0.0.0.0:44739 0.0.0.0:* >> >> >> LISTEN >> >> >> tcp 0 0 0.0.0.0:6566 0.0.0.0:* >> >> >> LISTEN >> >> >> tcp 0 0 0.0.0.0:60135 0.0.0.0:* >> >> >> LISTEN >> >> >> tcp 0 0 0.0.0.0:111 0.0.0.0:* >> >> >> LISTEN >> >> >> tcp6 0 0 :::22 :::* >> >> >> LISTEN >> >> >> tcp6 0 0 ::1:631 :::* >> >> >> LISTEN >> >> >> tcp6 0 0 :::5432 :::* >> >> >> LISTEN >> >> >> tcp6 0 0 :::6566 :::* >> >> >> LISTEN >> >> >> tcp6 0 0 :::80 :::* >> >> >> LISTEN >> >> >> rob@roblaptop:~> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Wed, 2010-12-08 at 08:52 +1300, Oliver Jowett wrote: >> >> >>> On 08/12/10 02:29, Rob Stone wrote: >> >> >>> >> >> >>> > Wrote a mickey mouse java class (testdbconn) to see if I could access >> >> >>> > the database and read data from a table that has two rows. >> >> See attached. >> >> >>> > When it runs it displays the same SQL error code as ExecuteQuery -- >> >> >>> > 08001 -- which is the "can't connect error". >> >> >>> >> >> >>> You have a network configuration problem of some sort: >> >> >>> >> >> >>> > Caused by: java.net.SocketException: Network is unreachable >> >> >>> >> >> >>> (This isn't "connection refused", it's "I have no configured route to >> >> >>> that address") >> >> >>> >> >> >>> Oliver >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> >> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) >> >> >> To make changes to your subscription: >> >> >> http://www.postgresql.org/mailpref/pgsql-jdbc >> >> >> >> >> > >> >> > -- >> >> > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) >> >> > To make changes to your subscription: >> >> > http://www.postgresql.org/mailpref/pgsql-jdbc >> >> > >> >> >> >> >> > >> > >> >> > > >
Hi Radoslaw, A Thomas Markus sent me a workaround. See below. --- maybe this is your problem http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560056 try to start your java class with -Djava.net.preferIPv4Stack=true --- Using the -D option running java works. Now to sort out my l0 issue!! Thanks to everybody for your assistance. At first glance I thought it was a JDBC issue and I'm sorry to have troubled you all when it is related to something entirely different. Regards, Rob On Fri, 2010-12-10 at 04:38 -0500, Radosław Smogura wrote: > Hi, > > I think you have badly configured routing table, I don't see there > loopback routing (lo device) > You should have line like this (lo - ended, 3rd line). > > 217.118.24.64 0.0.0.0 255.255.255.192 U 0 0 0 eth0 > 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 > 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo > 0.0.0.0 217.118.24.65 0.0.0.0 UG 0 0 0 eth0 > > I believe that you can connect to postmaster at IP 187.65.254.157 (if > it's not your dynamic address). After calling > route add -net 127.0.0.0 > you should connect as well. > > Check if you started all network interfaces at boot. Linux > distributions makes its different, you will need to call > /etc/init.d/*.lo or ifup lo from command line. Eventually check > /etc/sysconfig/network/ifcfg-lo there should be something like > STARTMODE=onboot > > I really wonder how you connect to http://localhost if you don't have > route to it. I hope this helps you. > > Kind regards, > Radosław smogura > http://softperience.eu > Cytowanie Rob Stone <robstone@mira.net>: > > > Hi Radek, > > > > Output from those commands attached. > > > > I always completely shutdown my laptop and pull the plug. So, it is > > doing a complete cold boot each time. > > > > When I try connecting to the database with ExecuteQuery, the same error > > is returned for both "localhost" and 127.0.0.1, when entering those > > values as the "host" on the connection dialogue. > > > > Via a browser, if I access http://localhost it returns the "It Work's!" > > output from apache. > > > > Thanks to everybody for your help. > > > > Cheers, > > Rob > > > > > > > > On Thu, 2010-12-09 at 15:43 -0500, Radosław Smogura wrote: > >> Hi, > >> > >> Check with netstat -atnp (it shows the process associated with port), > >> but psql should be there. > >> > >> Do route -n to see routing traces, execute ifconfig next. > >> > >> But this can be kernel driver problem. Do you "shut down" laptop by > >> closing it, I mean do you put it in sleep mode? Maybe you need to > >> restart network interfaces instead. > >> > >> On my PC when I put it on sleep mode, SATA controller doesn't wakes up. > >> > >> Kind regards, > >> Radek Smogura > >> > Rob, > >> > > >> > Have you tried 127.0.0.1 instead of localhost ? It's not that it isn't > >> > listening, the problem is there is no route to localhost which seems > >> > strange on it's own. > >> > > >> > Dave > >> > > >> > On Thu, Dec 9, 2010 at 8:18 AM, Rob Stone <robstone@mira.net> wrote: > >> >> Hi Oliver, > >> >> > >> >> Thanks for the reply. > >> >> > >> >> Output from netstat shows port 5432 as being listened. Don't know what > >> >> to try next. > >> >> > >> >> Sometimes when I shut down my laptop the "stop" messages are displayed. > >> >> I noticed last night that pg_ctl could not find the postmaster.pid file, > >> >> even though PGHOST and PGDATA variables are set. I'm starting it with > >> >> the -i and -D options with -D pointing explicitly to the PGDATA path > >> >> using the full path name. Could not finding a postmaster.pid file be > >> >> linked in any way with my problem?? > >> >> > >> >> > >> >> Cheers, > >> >> Rob > >> >> > >> >> rob@roblaptop:~> netstat -ln --tcp > >> >> Active Internet connections (only servers) > >> >> Proto Recv-Q Send-Q Local Address Foreign Address > >> >> State > >> >> tcp 0 0 0.0.0.0:22 0.0.0.0:* > >> >> LISTEN > >> >> tcp 0 0 127.0.0.1:631 0.0.0.0:* > >> >> LISTEN > >> >> tcp 0 0 0.0.0.0:5432 0.0.0.0:* > >> >> LISTEN > >> >> tcp 0 0 0.0.0.0:58112 0.0.0.0:* > >> >> LISTEN > >> >> tcp 0 0 0.0.0.0:2049 0.0.0.0:* > >> >> LISTEN > >> >> tcp 0 0 0.0.0.0:44739 0.0.0.0:* > >> >> LISTEN > >> >> tcp 0 0 0.0.0.0:6566 0.0.0.0:* > >> >> LISTEN > >> >> tcp 0 0 0.0.0.0:60135 0.0.0.0:* > >> >> LISTEN > >> >> tcp 0 0 0.0.0.0:111 0.0.0.0:* > >> >> LISTEN > >> >> tcp6 0 0 :::22 :::* > >> >> LISTEN > >> >> tcp6 0 0 ::1:631 :::* > >> >> LISTEN > >> >> tcp6 0 0 :::5432 :::* > >> >> LISTEN > >> >> tcp6 0 0 :::6566 :::* > >> >> LISTEN > >> >> tcp6 0 0 :::80 :::* > >> >> LISTEN > >> >> rob@roblaptop:~> > >> >> > >> >> > >> >> > >> >> > >> >> On Wed, 2010-12-08 at 08:52 +1300, Oliver Jowett wrote: > >> >>> On 08/12/10 02:29, Rob Stone wrote: > >> >>> > >> >>> > Wrote a mickey mouse java class (testdbconn) to see if I could access > >> >>> > the database and read data from a table that has two rows. > >> See attached. > >> >>> > When it runs it displays the same SQL error code as ExecuteQuery -- > >> >>> > 08001 -- which is the "can't connect error". > >> >>> > >> >>> You have a network configuration problem of some sort: > >> >>> > >> >>> > Caused by: java.net.SocketException: Network is unreachable > >> >>> > >> >>> (This isn't "connection refused", it's "I have no configured route to > >> >>> that address") > >> >>> > >> >>> Oliver > >> >> > >> >> > >> >> > >> >> -- > >> >> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > >> >> To make changes to your subscription: > >> >> http://www.postgresql.org/mailpref/pgsql-jdbc > >> >> > >> > > >> > -- > >> > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > >> > To make changes to your subscription: > >> > http://www.postgresql.org/mailpref/pgsql-jdbc > >> > > >> > >> > > > > > >