pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Connection problem
24+ messages / 14 participants
[nested] [flat]

* Connection problem
@ 2003-08-04 06:37 Ripon Al Wasim <riponc007@yahoo.com>
  2003-08-04 21:01 ` Re: Connection problem Kris Jurka <books@ejurka.com>
  2003-08-04 21:55 ` Re: Connection problem Erik Price <eprice@ptc.com>
  0 siblings, 2 replies; 24+ messages in thread

From: Ripon Al Wasim @ 2003-08-04 06:37 UTC (permalink / raw)
  To: pgsql-jdbc

hello,
I wanna connet between java and PostgreSQL. Here is the code:
 
import java.sql.*;
public class DBConnection
{
 public void connection()
 {
  String pgsqlDriver = "org.postgresql.Driver";
  //String pgsqlURL = "jdbc:postgresql://host:5432/mydb";
  String pgsqlURL = "jdbc:postgresql://192.168.0.165/testdb";
  String pgsqlUser = "User";
  String pgsqlPW = "password";
  String pgsqlQuery = null;
  Connection pgsqlConn = null;
  Statement pgsqlStatement = null;
  ResultSet pgsqlRSet = null;
  try
  {
    Class.forName(pgsqlDriver);
    pgsqlConn = DriverManager.getConnection(pgsqlURL, pgsqlUser, pgsqlPW);
    pgsqlStatement = pgsqlConn.createStatement();
    pgsqlQuery = "SELECT * FROM users;";
    pgsqlRSet = pgsqlStatement.executeQuery(pgsqlQuery);
  }
  catch (ClassNotFoundException cnfe)
  {
    System.out.println("Could not load database driver:" + cnfe.getMessage());
  }
  catch (SQLException sqle)
  {
    System.out.println("Could not connect to the database: " + sqle.getMessage());
  }
  finally
  {
    try
    {
   if ( pgsqlConn != null )
   {
   // Close the connection no matter what.
   pgsqlConn.close();
   }
    }
    catch (SQLException sqle)
    {
   System.out.println("Could not connect to the database(2): " + sqle.getMessage());
    }
  }//finally
 }//end connection()
 public static void main(String args[])
 {
  new DBConnection().connection();
 }
}//class
 
The code is compile well. But here is a runtime problem. The prolem is:
 
Could not load database driver :org.postgresql.Driver
 
Is there anybody to help me?
 
thanking u,
Ripon
 


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection problem
  2003-08-04 06:37 Connection problem Ripon Al Wasim <riponc007@yahoo.com>
@ 2003-08-04 21:01 ` Kris Jurka <books@ejurka.com>
  1 sibling, 0 replies; 24+ messages in thread

From: Kris Jurka @ 2003-08-04 21:01 UTC (permalink / raw)
  To: Ripon Al Wasim <riponc007@yahoo.com>; +Cc: pgsql-jdbc



On Sun, 3 Aug 2003, Ripon Al Wasim wrote:

> The code is compile well. But here is a runtime problem. The prolem is:
>
> Could not load database driver :org.postgresql.Driver
>

It looks like you do not have the postgresql jdbc driver in your
CLASSPATH.

Kris Jurka





^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection problem
  2003-08-04 06:37 Connection problem Ripon Al Wasim <riponc007@yahoo.com>
@ 2003-08-04 21:55 ` Erik Price <eprice@ptc.com>
  1 sibling, 0 replies; 24+ messages in thread

From: Erik Price @ 2003-08-04 21:55 UTC (permalink / raw)
  To: Ripon Al Wasim <riponc007@yahoo.com>; +Cc: pgsql-jdbc



Ripon Al Wasim wrote:

> The code is compile well. But here is a runtime problem. The prolem is:
>  
> Could not load database driver :org.postgresql.Driver

Note that the PostgreSQL driver JAR file must be in your $CLASSPATH or 
%CLASSPATH%.  This means not just in a directory that is in your 
CLASSPATH (like with package directories or class files), but the 
CLASSPATH must actually explicitly list the location of the PostgreSQL 
driver JAR file.



Erik




^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection problem
@ 2003-08-04 21:17 Scot P. Floess <floess@mindspring.com>
  0 siblings, 0 replies; 24+ messages in thread

From: Scot P. Floess @ 2003-08-04 21:17 UTC (permalink / raw)
  To: Ripon Al Wasim <riponc007@yahoo.com>; pgsql-jdbc

Do you have the appropriate postgres jar in your class path?

Original message attached.

Attachments:

MESSAGE.HTML (text/html, 2.8K) download <DIV>hello,</DIV> <DIV>I wanna connet between java and PostgreSQL. Here is the code:</DIV> <DIV>&nbsp;</DIV> <DIV>import java.sql.*;</DIV> <DIV>public class DBConnection<BR>{</DIV> <DIV>&nbsp;public void connection()<BR>&nbsp;{<BR>&nbsp;&nbsp;String pgsqlDriver = "org.postgresql.Driver";<BR>&nbsp;&nbsp;//String pgsqlURL = "jdbc:postgresql://host:5432/mydb";<BR>&nbsp;&nbsp;String pgsqlURL = "jdbc:postgresql://192.168.0.165/testdb";</DIV> <DIV>&nbsp;&nbsp;String pgsqlUser = "User";<BR>&nbsp;&nbsp;String pgsqlPW = "password";<BR>&nbsp;&nbsp;String pgsqlQuery = null;<BR>&nbsp;&nbsp;Connection pgsqlConn = null;<BR>&nbsp;&nbsp;Statement pgsqlStatement = null;<BR>&nbsp;&nbsp;ResultSet pgsqlRSet = null;</DIV> <DIV>&nbsp;&nbsp;try<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp; Class.forName(pgsqlDriver);<BR>&nbsp;&nbsp;&nbsp; pgsqlConn = DriverManager.getConnection(pgsqlURL, pgsqlUser, pgsqlPW);<BR>&nbsp;&nbsp;&nbsp; pgsqlStatement = pgsqlConn.createStatement();<BR>&nbsp;&nbsp;&nbsp; pgsqlQuery = "SELECT * FROM users;";<BR>&nbsp;&nbsp;&nbsp; pgsqlRSet = pgsqlStatement.executeQuery(pgsqlQuery);<BR>&nbsp;&nbsp;}</DIV> <DIV>&nbsp;&nbsp;catch (ClassNotFoundException cnfe)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp; System.out.println("Could not load database driver:" + cnfe.getMessage());<BR>&nbsp;&nbsp;}</DIV> <DIV>&nbsp;&nbsp;catch (SQLException sqle)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp; System.out.println("Could not connect to the database: " + sqle.getMessage());<BR>&nbsp;&nbsp;}</DIV> <DIV>&nbsp;&nbsp;finally<BR>&nbsp;&nbsp;{</DIV> <DIV>&nbsp;&nbsp;&nbsp; try<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;if ( pgsqlConn != null )<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;// Close the connection no matter what.<BR>&nbsp;&nbsp;&nbsp;pgsqlConn.close();<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp; }</DIV> <DIV>&nbsp;&nbsp;&nbsp; catch (SQLException sqle)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;System.out.println("Could not connect to the database(2): " + sqle.getMessage());<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;}//finally<BR>&nbsp;}//end connection()</DIV> <DIV>&nbsp;public static void main(String args[])<BR>&nbsp;{<BR>&nbsp;&nbsp;new DBConnection().connection();<BR>&nbsp;}<BR>}//class</DIV> <DIV>&nbsp;</DIV> <DIV>The code is compile well. But here is a runtime problem. The prolem is:</DIV> <DIV>&nbsp;</DIV> <DIV>Could not load database driver :<FONT color=#4040ff>org.postgresql.Driver</FONT></DIV> <DIV><FONT color=#4040ff></FONT>&nbsp;</DIV> <DIV><FONT color=#4040ff>Is there anybody to help me?</FONT></DIV> <DIV><FONT color=#4040ff></FONT>&nbsp;</DIV> <DIV><FONT color=#4040ff>thanking u,</FONT></DIV> <DIV><FONT color=#4040ff>Ripon</FONT></DIV> <DIV>&nbsp;</DIV><p><hr SIZE=1> Do you Yahoo!?<br> <a href="http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com">Yahoo! SiteBuilder</a> - Free, easy-to-use web site design software
^ permalink raw reply [nested|flat] 24+ messages in thread

* Connection problem
@ 2004-01-26 14:39 sandrine wamy wapet <wamywas@hotmail.com>
  2004-01-26 15:43 ` Re: Connection problem Dennis Romero L. <dromero@ceibo.fiec.espol.edu.ec>
  0 siblings, 1 reply; 24+ messages in thread

From: sandrine wamy wapet @ 2004-01-26 14:39 UTC (permalink / raw)
  To: pgsql-jdbc

Hi everybody,

I'm using Postgresql 7.2 release and the JDK 1.4.1. I think I must use the 
pg72jdbc2.jar.
However, I have a problem when I try to connect the database. When running 
my code, I have "NoClassDefFoundError" generated by the method forName.
I verify my classpath contains the path to the driver 
(/opt/java/jre/lib/pg72jdbc2.jar).

If somebody can help me...

Thanks
sww

_________________________________________________________________
MSN Search, le moteur de recherche qui pense comme vous !  
http://search.msn.fr




^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection problem
  2004-01-26 14:39 Connection problem sandrine wamy wapet <wamywas@hotmail.com>
@ 2004-01-26 15:43 ` Dennis Romero L. <dromero@ceibo.fiec.espol.edu.ec>
  0 siblings, 0 replies; 24+ messages in thread

From: Dennis Romero L. @ 2004-01-26 15:43 UTC (permalink / raw)
  To: 'sandrine wamy wapet' <wamywas@hotmail.com>; pgsql-jdbc

Hi!

I had a similar problem, made sure that you pg72jdbc2.jar have the correct
permissions. To my it works in the path: /opt/java/jre/lib/ext/ test here,
maybe this is the problem

Bye

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of sandrine wamy wapet
Sent: Lunes, 26 de Enero de 2004 9:40
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] Connection problem

Hi everybody,

I'm using Postgresql 7.2 release and the JDK 1.4.1. I think I must use the 
pg72jdbc2.jar.
However, I have a problem when I try to connect the database. When running 
my code, I have "NoClassDefFoundError" generated by the method forName.
I verify my classpath contains the path to the driver 
(/opt/java/jre/lib/pg72jdbc2.jar).

If somebody can help me...

Thanks
sww

_________________________________________________________________
MSN Search, le moteur de recherche qui pense comme vous !  
http://search.msn.fr


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings




^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection problem
@ 2004-01-27 15:10 sandrine wamy wapet <wamywas@hotmail.com>
  0 siblings, 0 replies; 24+ messages in thread

From: sandrine wamy wapet @ 2004-01-27 15:10 UTC (permalink / raw)
  To: dromero@ceibo.fiec.espol.edu.ec; pgsql-jdbc

Hi,

Everything is working now, thank you for help!!!!!


----Original Message Follows----
From: "Dennis Romero L." <dromero@ceibo.fiec.espol.edu.ec>
To: "'sandrine wamy wapet'" <wamywas@hotmail.com>, 
<pgsql-jdbc@postgresql.org>
Subject: RE: [JDBC] Connection problem
Date: Mon, 26 Jan 2004 10:43:15 -0500

Hi!

I had a similar problem, made sure that you pg72jdbc2.jar have the correct
permissions. To my it works in the path: /opt/java/jre/lib/ext/ test here,
maybe this is the problem

Bye

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of sandrine wamy wapet
Sent: Lunes, 26 de Enero de 2004 9:40
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] Connection problem

Hi everybody,

I'm using Postgresql 7.2 release and the JDK 1.4.1. I think I must use the
pg72jdbc2.jar.
However, I have a problem when I try to connect the database. When running
my code, I have "NoClassDefFoundError" generated by the method forName.
I verify my classpath contains the path to the driver
(/opt/java/jre/lib/pg72jdbc2.jar).

If somebody can help me...

Thanks
sww

_________________________________________________________________
MSN Search, le moteur de recherche qui pense comme vous !
http://search.msn.fr


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

_________________________________________________________________
MSN Messenger  http://g.msn.fr/FR1001/866 : un logiciel gratuit pour 
dialoguer avec vos amis !




^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Connection problem
@ 2004-01-28 17:40 michel.verplancke <michel.verplancke@wanadoo.be>
  2004-01-28 23:07 ` Re: Connection problem Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 24+ messages in thread

From: michel.verplancke @ 2004-01-28 17:40 UTC (permalink / raw)
  To: pgsql-jdbc

Hi everybody,

Here is my problem

I have a JAVA application running on W2K connected with PostgreSQL 7.4 running on a Linux box

If I use pg73jdbc3.jar within JAVA , everything is working fine

If I try to use  pg741jdbc3.jar, (which I dowloaded from http://jdbc.postgresql.org ) I can not read Postgresql anymore !!

Do I have to do something special , or did I do something wrong ?

Thanks

michel.verplancke@wanadoo.be

^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection problem
  2004-01-28 17:40 Connection problem michel.verplancke <michel.verplancke@wanadoo.be>
@ 2004-01-28 23:07 ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 24+ messages in thread

From: Kris Jurka @ 2004-01-28 23:07 UTC (permalink / raw)
  To: michel.verplancke <michel.verplancke@wanadoo.be>; +Cc: pgsql-jdbc



On Wed, 28 Jan 2004, michel.verplancke wrote:

> Hi everybody,
>
> Here is my problem
>
> I have a JAVA application running on W2K connected with PostgreSQL 7.4 running on a Linux box
>
> If I use pg73jdbc3.jar within JAVA , everything is working fine
>
> If I try to use  pg741jdbc3.jar, (which I dowloaded from http://jdbc.postgresql.org ) I can not read Postgresql anymore !!
>
> Do I have to do something special , or did I do something wrong ?
>

You should not need to do anything special.  In fact I would have expect
only the 7.4 jar file to work and the 7.3 version to fail.  You will need
to be more specific about "I can not read Postgresql anymore!!"  Do you
get an error message?  What happens?

Kris Jurka




^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Connection Problem
@ 2007-01-10 04:46 Rich Rutkowski <innovapos@mindspring.com>
  2007-01-10 12:04 ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
  0 siblings, 1 reply; 24+ messages in thread

From: Rich Rutkowski @ 2007-01-10 04:46 UTC (permalink / raw)
  To: pgsql-jdbc

Hardware:  Acer 9300
CPU:  Dual Core Turion 64bit
OS:  Suse Linux 10.1 with all upgrades and running as 64 bit.
1 GB Ram
Both IPV4 and IPV6 are running on the system

JDBC Driver: postgres-8.2-504.jdbc3 (same problem with 8.1-405)
Server:  Postgres 8.1.5

The problem is that after 2 successful connections to a database and 
retrival of data the driver throws the following  message:  "Something 
unusual has occurred to cause the driver to fail.  Pleas report this 
exception."  Note that the server doesn't complain only the driver.  If 
the java application is restarted the same scenerio occurrs. 

Both Postgres 8.1.5 and PG AdminIII wer built from source on this 
system.  PGAdmin can contanct the local server and also contact other 
servers in our development environment.  psql also works and serveral 
databases have been created and at least 60 tables.  We have been using 
postgresql for over 5 years and this is the first time we have seen the 
problem.  Any guidance, comments, things to try, etc would be 
appreciated.  Note that the application is packaged as a jar file and it 
runs without problems on other systems.

Thanks,

Rich Rutkowski




^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection Problem
  2007-01-10 04:46 Connection Problem Rich Rutkowski <innovapos@mindspring.com>
@ 2007-01-10 12:04 ` Dave Cramer <pg@fastcrypt.com>
  0 siblings, 0 replies; 24+ messages in thread

From: Dave Cramer @ 2007-01-10 12:04 UTC (permalink / raw)
  To: Rich Rutkowski <innovapos@mindspring.com>; +Cc: pgsql-jdbc

Do you have the stack trace?

Version of java ?

Dave
On 9-Jan-07, at 11:46 PM, Rich Rutkowski wrote:

> Hardware:  Acer 9300
> CPU:  Dual Core Turion 64bit
> OS:  Suse Linux 10.1 with all upgrades and running as 64 bit.
> 1 GB Ram
> Both IPV4 and IPV6 are running on the system
>
> JDBC Driver: postgres-8.2-504.jdbc3 (same problem with 8.1-405)
> Server:  Postgres 8.1.5
>
> The problem is that after 2 successful connections to a database  
> and retrival of data the driver throws the following  message:   
> "Something unusual has occurred to cause the driver to fail.  Pleas  
> report this exception."  Note that the server doesn't complain only  
> the driver.  If the java application is restarted the same scenerio  
> occurrs.
> Both Postgres 8.1.5 and PG AdminIII wer built from source on this  
> system.  PGAdmin can contanct the local server and also contact  
> other servers in our development environment.  psql also works and  
> serveral databases have been created and at least 60 tables.  We  
> have been using postgresql for over 5 years and this is the first  
> time we have seen the problem.  Any guidance, comments, things to  
> try, etc would be appreciated.  Note that the application is  
> packaged as a jar file and it runs without problems on other systems.
>
> Thanks,
>
> Rich Rutkowski
>
>
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>               http://archives.postgresql.org
>




^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Connection Problem
@ 2010-12-07 13:29 Rob Stone <robstone@mira.net>
  2010-12-07 19:52 ` Re: Connection Problem Oliver Jowett <oliver@opencloud.com>
  2010-12-10 07:27 ` Re: Connection Problem Thomas Markus <t.markus@proventis.net>
  0 siblings, 2 replies; 24+ messages in thread

From: Rob Stone @ 2010-12-07 13:29 UTC (permalink / raw)
  To: pgsql-jdbc

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

Attachments:

testdbconn.java (text/x-java, 1.3K) download import java.sql.*; import java.io.*; import javax.sql.DataSource; public class testdbconn { static String dbname = "aerobook"; static String dbuser = "aerobook"; static String dbpass = "aerobook"; static String dbhost = "localhost"; static String dbport = "5432"; static String dbtable = "companies"; public static void main(String[] args) throws Exception { try { DriverManager.registerDriver(new org.postgresql.Driver()); Class.forName("org.postgresql.Driver").newInstance(); String url = "jdbc:postgresql://" + dbhost + ":" + dbport + "/" + dbname; System.out.println("getConnection: url="+url); Connection conn = DriverManager.getConnection(url, dbuser, dbpass); Statement s = conn.createStatement(); String query = "select * from companies"; ResultSet rs; rs = s.executeQuery(query); while(rs.next()) { System.out.print(rs.getString("airline_code")); System.out.println(" - " + rs.getString("airline_name")); } s.close(); } catch (SQLException s) { System.out.println("SQL Error: " + s.toString() + " " + s.getErrorCode() + " " + s.getSQLState()); } catch (Exception e) { System.out.println("Error: " + e.toString() + e.getMessage()); } } }
eqstacktrace.txt (text/plain, 2.3K) download org.postgresql.util.PSQLException: The connection attempt failed. at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:150) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66) at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125) at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30) at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24) at org.postgresql.Driver.makeConnection(Driver.java:393) at org.postgresql.Driver.connect(Driver.java:267) at org.executequery.datasource.SimpleDataSource.getConnection(SimpleDataSource.java:100) at org.executequery.datasource.SimpleDataSource.getConnection(SimpleDataSource.java:80) at org.executequery.datasource.ConnectionPoolImpl.createConnection(ConnectionPoolImpl.java:198) at org.executequery.datasource.ConnectionPoolImpl.ensureCapacity(ConnectionPoolImpl.java:159) at org.executequery.datasource.ConnectionPoolImpl.setMinimumConnections(ConnectionPoolImpl.java:328) at org.executequery.datasource.ConnectionManager.createDataSource(ConnectionManager.java:87) at org.executequery.databasemediators.spi.DefaultConnectionBuilder.createDataSource(DefaultConnectionBuilder.java:123) at org.executequery.databasemediators.spi.DefaultConnectionBuilder.access$000(DefaultConnectionBuilder.java:35) at org.executequery.databasemediators.spi.DefaultConnectionBuilder$1.construct(DefaultConnectionBuilder.java:100) at org.underworldlabs.swing.util.SwingWorker$2.run(SwingWorker.java:130) at java.lang.Thread.run(Thread.java:619) Caused by: java.net.SocketException: Network is unreachable at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:519) at java.net.Socket.connect(Socket.java:469) at java.net.Socket.<init>(Socket.java:366) at java.net.Socket.<init>(Socket.java:180) at org.postgresql.core.PGStream.<init>(PGStream.java:62) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:76) ... 17 more
tdbconnout.txt (text/plain, 202B) download rob@roblaptop:bin> ./java testdbconn getConnection: url=jdbc:postgresql://localhost:5432/aerobook SQL Error: org.postgresql.util.PSQLException: The connection attempt failed. 0 08001 rob@roblaptop:bin>
^ permalink raw reply [nested|flat] 24+ messages in thread

* Re: Connection Problem
  2010-12-07 13:29 Connection Problem Rob Stone <robstone@mira.net>
@ 2010-12-07 19:52 ` Oliver Jowett <oliver@opencloud.com>
  2010-12-09 13:18   ` Re: Connection Problem Rob Stone <robstone@mira.net>
  1 sibling, 1 reply; 24+ messages in thread

From: Oliver Jowett @ 2010-12-07 19:52 UTC (permalink / raw)
  To: Rob Stone <robstone@mira.net>; +Cc: pgsql-jdbc

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



^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection Problem
  2010-12-07 13:29 Connection Problem Rob Stone <robstone@mira.net>
  2010-12-07 19:52 ` Re: Connection Problem Oliver Jowett <oliver@opencloud.com>
@ 2010-12-09 13:18   ` Rob Stone <robstone@mira.net>
  2010-12-09 20:18     ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
  0 siblings, 1 reply; 24+ messages in thread

From: Rob Stone @ 2010-12-09 13:18 UTC (permalink / raw)
  To: Oliver Jowett <oliver@opencloud.com>; +Cc: pgsql-jdbc

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





^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection Problem
  2010-12-07 13:29 Connection Problem Rob Stone <robstone@mira.net>
  2010-12-07 19:52 ` Re: Connection Problem Oliver Jowett <oliver@opencloud.com>
  2010-12-09 13:18   ` Re: Connection Problem Rob Stone <robstone@mira.net>
@ 2010-12-09 20:18     ` Dave Cramer <pg@fastcrypt.com>
  2010-12-09 20:43       ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
  0 siblings, 1 reply; 24+ messages in thread

From: Dave Cramer @ 2010-12-09 20:18 UTC (permalink / raw)
  To: Rob Stone <robstone@mira.net>; +Cc: Oliver Jowett <oliver@opencloud.com>; pgsql-jdbc

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
>



^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection Problem
  2010-12-07 13:29 Connection Problem Rob Stone <robstone@mira.net>
  2010-12-07 19:52 ` Re: Connection Problem Oliver Jowett <oliver@opencloud.com>
  2010-12-09 13:18   ` Re: Connection Problem Rob Stone <robstone@mira.net>
  2010-12-09 20:18     ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
@ 2010-12-09 20:43       ` Radosław Smogura <rsmogura@softperience.eu>
  2010-12-09 23:48         ` Re: Connection Problem Rob Stone <robstone@mira.net>
  0 siblings, 1 reply; 24+ messages in thread

From: Radosław Smogura @ 2010-12-09 20:43 UTC (permalink / raw)
  To: Dave Cramer <pg@fastcrypt.com>; +Cc: Rob Stone <robstone@mira.net>; Oliver Jowett <oliver@opencloud.com>; 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
>





^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection Problem
  2010-12-07 13:29 Connection Problem Rob Stone <robstone@mira.net>
  2010-12-07 19:52 ` Re: Connection Problem Oliver Jowett <oliver@opencloud.com>
  2010-12-09 13:18   ` Re: Connection Problem Rob Stone <robstone@mira.net>
  2010-12-09 20:18     ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
  2010-12-09 20:43       ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
@ 2010-12-09 23:48         ` Rob Stone <robstone@mira.net>
  2010-12-10 01:18           ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
  2010-12-10 09:38           ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
  0 siblings, 2 replies; 24+ messages in thread

From: Rob Stone @ 2010-12-09 23:48 UTC (permalink / raw)
  To: Radosław Smogura <rsmogura@softperience.eu>; +Cc: Dave Cramer <pg@fastcrypt.com>; Oliver Jowett <oliver@opencloud.com>; 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
> >
> 
> 

Attachments:

netstatout.txt (text/plain, 3.1K) download roblaptop:/home/rob# netstat -atnp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1617/sshd tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2217/cupsd tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 1707/postmaster tcp 0 0 0.0.0.0:33308 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:52670 0.0.0.0:* LISTEN 1342/rpc.statd tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:6566 0.0.0.0:* LISTEN 1791/saned tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1330/portmap tcp 0 0 0.0.0.0:60496 0.0.0.0:* LISTEN 1763/rpc.mountd tcp6 0 0 :::22 :::* LISTEN 1617/sshd tcp6 0 0 ::1:631 :::* LISTEN 2217/cupsd tcp6 0 0 :::5432 :::* LISTEN 1707/postmaster tcp6 0 0 :::6566 :::* LISTEN 1791/saned tcp6 0 0 :::80 :::* LISTEN 2335/apache2 roblaptop:/home/rob# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 187.65.240.0 0.0.0.0 255.255.240.0 U 1 0 0 eth0 0.0.0.0 187.65.240.1 0.0.0.0 UG 0 0 0 eth0 roblaptop:/home/rob# roblaptop:/home/rob# ifconfig eth0 Link encap:Ethernet HWaddr 00:a0:d1:7b:f4:e9 inet addr:187.65.254.157 Bcast:187.65.255.255 Mask:255.255.240.0 inet6 addr: fe80::2a0:d1ff:fe7b:f4e9/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:210220 errors:0 dropped:0 overruns:0 frame:0 TX packets:139047 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:146987784 (140.1 MiB) TX bytes:56897901 (54.2 MiB) Interrupt:16 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:3084 errors:0 dropped:0 overruns:0 frame:0 TX packets:3084 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:794627 (776.0 KiB) TX bytes:794627 (776.0 KiB) wlan0 Link encap:Ethernet HWaddr 00:13:e8:49:73:69 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) roblaptop:/home/rob#
^ permalink raw reply [nested|flat] 24+ messages in thread

* Re: Connection Problem
  2010-12-07 13:29 Connection Problem Rob Stone <robstone@mira.net>
  2010-12-07 19:52 ` Re: Connection Problem Oliver Jowett <oliver@opencloud.com>
  2010-12-09 13:18   ` Re: Connection Problem Rob Stone <robstone@mira.net>
  2010-12-09 20:18     ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
  2010-12-09 20:43       ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
  2010-12-09 23:48         ` Re: Connection Problem Rob Stone <robstone@mira.net>
@ 2010-12-10 01:18           ` Dave Cramer <pg@fastcrypt.com>
  1 sibling, 0 replies; 24+ messages in thread

From: Dave Cramer @ 2010-12-10 01:18 UTC (permalink / raw)
  To: Rob Stone <robstone@mira.net>; +Cc: Radosław Smogura <rsmogura@softperience.eu>; Oliver Jowett <oliver@opencloud.com>; pgsql-jdbc

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
>> >
>>
>>
>
>



^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection Problem
  2010-12-07 13:29 Connection Problem Rob Stone <robstone@mira.net>
  2010-12-07 19:52 ` Re: Connection Problem Oliver Jowett <oliver@opencloud.com>
  2010-12-09 13:18   ` Re: Connection Problem Rob Stone <robstone@mira.net>
  2010-12-09 20:18     ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
  2010-12-09 20:43       ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
  2010-12-09 23:48         ` Re: Connection Problem Rob Stone <robstone@mira.net>
@ 2010-12-10 09:38           ` Radosław Smogura <rsmogura@softperience.eu>
  2010-12-10 10:00             ` Re: Connection Problem Thomas Markus <t.markus@proventis.net>
  2010-12-10 13:15             ` Re: Connection Problem Rob Stone <robstone@mira.net>
  1 sibling, 2 replies; 24+ messages in thread

From: Radosław Smogura @ 2010-12-10 09:38 UTC (permalink / raw)
  To: Rob Stone <robstone@mira.net>; +Cc: Dave Cramer <pg@fastcrypt.com>; Oliver Jowett <oliver@opencloud.com>; pgsql-jdbc

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
>> >
>>
>>
>
>





^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection Problem
  2010-12-07 13:29 Connection Problem Rob Stone <robstone@mira.net>
  2010-12-07 19:52 ` Re: Connection Problem Oliver Jowett <oliver@opencloud.com>
  2010-12-09 13:18   ` Re: Connection Problem Rob Stone <robstone@mira.net>
  2010-12-09 20:18     ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
  2010-12-09 20:43       ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
  2010-12-09 23:48         ` Re: Connection Problem Rob Stone <robstone@mira.net>
  2010-12-10 09:38           ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
@ 2010-12-10 10:00             ` Thomas Markus <t.markus@proventis.net>
  1 sibling, 0 replies; 24+ messages in thread

From: Thomas Markus @ 2010-12-10 10:00 UTC (permalink / raw)
  To: 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>:
>




^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection Problem
  2010-12-07 13:29 Connection Problem Rob Stone <robstone@mira.net>
  2010-12-07 19:52 ` Re: Connection Problem Oliver Jowett <oliver@opencloud.com>
  2010-12-09 13:18   ` Re: Connection Problem Rob Stone <robstone@mira.net>
  2010-12-09 20:18     ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
  2010-12-09 20:43       ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
  2010-12-09 23:48         ` Re: Connection Problem Rob Stone <robstone@mira.net>
  2010-12-10 09:38           ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
@ 2010-12-10 13:15             ` Rob Stone <robstone@mira.net>
  2010-12-10 13:58               ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
  1 sibling, 1 reply; 24+ messages in thread

From: Rob Stone @ 2010-12-10 13:15 UTC (permalink / raw)
  To: Radosław Smogura <rsmogura@softperience.eu>; +Cc: Dave Cramer <pg@fastcrypt.com>; Oliver Jowett <oliver@opencloud.com>; 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
> >> >
> >>
> >>
> >
> >
> 
> 





^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection Problem
  2010-12-07 13:29 Connection Problem Rob Stone <robstone@mira.net>
  2010-12-07 19:52 ` Re: Connection Problem Oliver Jowett <oliver@opencloud.com>
  2010-12-09 13:18   ` Re: Connection Problem Rob Stone <robstone@mira.net>
  2010-12-09 20:18     ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
  2010-12-09 20:43       ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
  2010-12-09 23:48         ` Re: Connection Problem Rob Stone <robstone@mira.net>
  2010-12-10 09:38           ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
  2010-12-10 13:15             ` Re: Connection Problem Rob Stone <robstone@mira.net>
@ 2010-12-10 13:58               ` Dave Cramer <pg@fastcrypt.com>
  0 siblings, 0 replies; 24+ messages in thread

From: Dave Cramer @ 2010-12-10 13:58 UTC (permalink / raw)
  To: Rob Stone <robstone@mira.net>; +Cc: Radosław Smogura <rsmogura@softperience.eu>; Oliver Jowett <oliver@opencloud.com>; pgsql-jdbc

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
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
>



^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection Problem
  2010-12-07 13:29 Connection Problem Rob Stone <robstone@mira.net>
@ 2010-12-10 07:27 ` Thomas Markus <t.markus@proventis.net>
  1 sibling, 0 replies; 24+ messages in thread

From: Thomas Markus @ 2010-12-10 07:27 UTC (permalink / raw)
  To: Rob Stone <robstone@mira.net>; +Cc: 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
>
>
>




^ permalink  raw  reply  [nested|flat] 24+ messages in thread

* Re: Connection Problem
@ 2010-12-10 01:07 Jeff Hubbach <Jeff.Hubbach@cha.com>
  0 siblings, 0 replies; 24+ messages in thread

From: Jeff Hubbach @ 2010-12-10 01:07 UTC (permalink / raw)
  To: 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
> >
>
>



^ permalink  raw  reply  [nested|flat] 24+ messages in thread


end of thread, other threads:[~2010-12-10 13:58 UTC | newest]

Thread overview: 24+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-08-04 06:37 Connection problem Ripon Al Wasim <riponc007@yahoo.com>
2003-08-04 21:01 ` Kris Jurka <books@ejurka.com>
2003-08-04 21:55 ` Erik Price <eprice@ptc.com>
2003-08-04 21:17 Re: Connection problem Scot P. Floess <floess@mindspring.com>
2004-01-26 14:39 Connection problem sandrine wamy wapet <wamywas@hotmail.com>
2004-01-26 15:43 ` Dennis Romero L. <dromero@ceibo.fiec.espol.edu.ec>
2004-01-27 15:10 Re: Connection problem sandrine wamy wapet <wamywas@hotmail.com>
2004-01-28 17:40 Connection problem michel.verplancke <michel.verplancke@wanadoo.be>
2004-01-28 23:07 ` Kris Jurka <books@ejurka.com>
2007-01-10 04:46 Connection Problem Rich Rutkowski <innovapos@mindspring.com>
2007-01-10 12:04 ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
2010-12-07 13:29 Connection Problem Rob Stone <robstone@mira.net>
2010-12-07 19:52 ` Re: Connection Problem Oliver Jowett <oliver@opencloud.com>
2010-12-09 13:18   ` Re: Connection Problem Rob Stone <robstone@mira.net>
2010-12-09 20:18     ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
2010-12-09 20:43       ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
2010-12-09 23:48         ` Re: Connection Problem Rob Stone <robstone@mira.net>
2010-12-10 01:18           ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
2010-12-10 09:38           ` Re: Connection Problem Radosław Smogura <rsmogura@softperience.eu>
2010-12-10 10:00             ` Re: Connection Problem Thomas Markus <t.markus@proventis.net>
2010-12-10 13:15             ` Re: Connection Problem Rob Stone <robstone@mira.net>
2010-12-10 13:58               ` Re: Connection Problem Dave Cramer <pg@fastcrypt.com>
2010-12-10 07:27 ` Re: Connection Problem Thomas Markus <t.markus@proventis.net>
2010-12-10 01:07 Re: Connection Problem Jeff Hubbach <Jeff.Hubbach@cha.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox