Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 732EA6414AE for ; Wed, 27 Jan 2010 15:28:48 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 51161-03 for ; Wed, 27 Jan 2010 19:28:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from fmmailgate03.web.de (fmmailgate03.web.de [217.72.192.234]) by mail.postgresql.org (Postfix) with ESMTP id 0459F641791 for ; Wed, 27 Jan 2010 15:02:49 -0400 (AST) Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate03.web.de (Postfix) with ESMTP id C781513CBB06F for ; Wed, 27 Jan 2010 20:02:46 +0100 (CET) Received: from [213.188.108.184] (helo=[192.168.2.2]) by smtp06.web.de with esmtp (WEB.DE 4.110 #314) id 1NaDA4-00084O-00 for pgsql-jdbc@postgresql.org; Wed, 27 Jan 2010 20:02:44 +0100 Subject: java.net.SocketException: Network is unreachable From: Wolfgang Rinnert To: pgsql-jdbc@postgresql.org Content-Type: text/plain; charset="UTF-8" Date: Wed, 27 Jan 2010 20:02:39 +0100 Message-ID: <1264618959.4222.2.camel@pcwolfgang.weser12a> Mime-Version: 1.0 X-Mailer: Evolution 2.28.2 Content-Transfer-Encoding: quoted-printable X-Sender: wrinnert@web.de X-Provags-ID: V01U2FsdGVkX1/TrpJgmwifGJK7JjDxBPStuGQc6VHEAOm/w7tK DHxfCeufBXg0Zft9ypXaWhQRDYPYsvNTJOqL+HzXm/zK6HEZh0 cAyeB8gsw= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=-10 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 201001/70 X-Sequence-Number: 20266 Hello list, = = =20 since I switched from a AMD Athlon based 32bit single core machine to a 64bit quad-core, a cannot run my Postgresql Java programs. =20 I do everything using Debian testing. The new machine was installed from scratch. = =20 Here is the output of "uname -a": = = =20 Linux pcwolfgang 2.6.30-2-amd64 #1 SMP Mon Dec 7 05:21:45 UTC 2009 x86_64 GNU/Linux = =20 = = =20 I migrated using pg_dump / psql -i without problems. = =20 On the old machine I had postgresql 8.3, now I have 8.4. Details below. = =20 The old jdbc driver was called postgresql-8.3-603.jdbc4.jar, currently I have postgresql-8.4-701.jdbc4.jar. = =20 = = =20 I can see and modify my data through psql (through socket as well as tcp/ip access). = =20 But running a java program gives me an exception crash. = =20 = = =20 Now for the details. I have put the statements between lines of equal signs, their output directly following. = =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = = =20 postgres@pcwolfgang:/root $ /usr/lib/postgresql/8.4/bin/pg_controldata = = =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = = =20 pg_control-Versionsnummer: 843 = =20 Katalogversionsnummer: 200904091 = =20 Datenbanksystemidentifikation: 5420760379678260442 = =20 Datenbank-Cluster-Status: im Produktionsmodus = =20 pg_control zuletzt ge=C3=A4ndert: Mo 25 Jan 2010 18:04:48 CET = =20 Position des letzten Checkpoints: 0/9B91F8 = =20 Position des vorletzten Checkpoints: 0/9B91B0 = =20 REDO-Position des letzten Checkpoints: 0/9B91F8 = =20 TimeLineID des letzten Checkpoints: 1 = =20 NextXID des letzten Checkpoints: 0/17583 = =20 NextOID des letzten Checkpoints: 16545 = =20 NextMultiXactId des letzten Checkpoints: 1 = =20 NextMultiOffset des letzten Checkpoints: 0 = =20 Zeit des letzten Checkpoints: So 24 Jan 2010 23:35:16 CET = =20 Minimaler Wiederherstellungsendpunkt: 0/0 = =20 Maximale Datenausrichtung (Alignment): 8 = =20 Datenbankblockgr=C3=B6=C3=9Fe: 8192 = =20 Bl=C3=B6cke pro Segment: 131072 = =20 WAL-Blockgr=C3=B6=C3=9Fe: 8192 = =20 Bytes pro WAL-Segment: 16777216 = =20 Maximale Bezeichnerl=C3=A4nge: 64 = =20 Maximale Spalten in einem Index: 32 = =20 Maximale Gr=C3=B6=C3=9Fe eines St=C3=BCcks TOAST: 1996 = =20 Speicherung von Datum/Zeit-Typen: 64-Bit-Ganzzahlen = =20 =C3=9Cbergabe von Float4-Argumenten: Wert = =20 =C3=9Cbergabe von Float8-Argumenten: Wert = =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D wolfgang@pcwolfgang:~$ pg_lsclusters =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Version Cluster Port Status Owner Data directory Log file 8.4 main 5432 online postgres /var/lib/postgresql/8.4/main /var/log/postgresql/postgresql-= 8.4-main.log =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D postgres@pcwolfgang:/root$ ps aux | grep -i post =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D postgres 2115 0.0 0.3 102320 6428 ? S 18:04 0:01 /usr/lib/postgresql/8.4/bin/postgres -D /var/lib/postgresql/8.4/main -c config_file=3D/etc/postgresql/8.4/main/postgresql.conf = = =20 postgres 2120 0.0 0.0 102320 1688 ? Ss 18:04 0:00 postgres: writer process = =20 postgres 2121 0.0 0.0 102320 1484 ? Ss 18:04 0:00 postgres: wal writer process = =20 postgres 2122 0.0 0.1 102600 1920 ? Ss 18:04 0:00 postgres: autovacuum launcher process = =20 postgres 2123 0.0 0.0 74012 1588 ? Ss 18:04 0:00 postgres: stats collector process = =20 postgres 3731 0.0 0.0 49356 1568 pts/0 S 18:34 0:00 su postgres = =20 postgres 3739 0.0 0.1 18964 1932 pts/0 S 18:34 0:00 bash = =20 postgres 3748 0.0 0.0 16072 1116 pts/0 R+ 18:35 0:00 ps aux = =20 postgres 3749 0.0 0.0 9348 936 pts/0 R+ 18:35 0:00 grep -i post = =20 This is the call to a little example java program. Its code follows below. Translation of the phrase in German "Der Verbindungsversuch schlug fehl." would be "The connection attempt failed." =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = =20 wolfgang@pcwolfgang:~/programming/java/lotto$ java jdbc_002_driverinfo =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = =20 18:13:26.852 (1) PostgreSQL 8.4 JDBC4 (build 701) =20 18:13:26.878 (1) Trying to establish a protocol version 3 connection to 127.0.0.1:5432 =20 org.postgresql.util.PSQLException: Der Verbindungsversuch schlug fehl. =20 at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionF= actoryImpl.java:150) =20 at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java= :66) =20 at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection= .java:125) =20 at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection= .java:30) =20 at org.postgresql.jdbc3g.AbstractJdbc3gConnection.(AbstractJdbc3gConnect= ion.java:22) = = = =20 at org.postgresql.jdbc4.AbstractJdbc4Connection.(AbstractJdbc4Connection= .java:30) = = = =20 at org.postgresql.jdbc4.Jdbc4Connection.(Jdbc4Connection.java:24) = = = = =20 at org.postgresql.Driver.makeConnection(Driver.java:393) = = = = =20 at org.postgresql.Driver.access $100(Driver.java:47) = = = = =20 at org.postgresql.Driver $ConnectThread.run(Driver.java:308) = =20 at java.lang.Thread.run(Thread.java:619) = = =20 SQLException: SQLState(08001) = = =20 getConnection failed: org.postgresql.util.PSQLException: Der Verbindungsversuch schlug fehl. = =20 Exception in thread "main" org.postgresql.util.PSQLException: Der Verbindungsversuch schlug fehl. = =20 at org.postgresql.Driver $ConnectThread.getResult(Driver.java:348) = =20 at org.postgresql.Driver.connect(Driver.java:271) = = =20 at java.sql.DriverManager.getConnection(DriverManager.java:582) = = =20 at java.sql.DriverManager.getConnection(DriverManager.java:154) = = =20 at jdbc_002_driverinfo.main(jdbc_002_driverinfo.java:19) = = =20 Caused by: java.net.SocketException: Network is unreachable = =20 at java.net.PlainSocketImpl.socketConnect(Native Method) = =20 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) = = =20 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) = = =20 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) = = =20 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) = = =20 at java.net.Socket.connect(Socket.java:525) = = =20 at java.net.Socket.connect(Socket.java:475) = = =20 at java.net.Socket.(Socket.java:372) = = =20 at java.net.Socket.(Socket.java:186) = = =20 at org.postgresql.core.PGStream.(PGStream.java:62) = = =20 at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionF= actoryImpl.java:76) = =20 at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java= :66) = =20 at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection= .java:125) = =20 at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection= .java:30) = =20 at org.postgresql.jdbc3g.AbstractJdbc3gConnection.(AbstractJdbc3gConnect= ion.java:22) = =20 at org.postgresql.jdbc4.AbstractJdbc4Connection.(AbstractJdbc4Connection= .java:30) = =20 at org.postgresql.jdbc4.Jdbc4Connection.(Jdbc4Connection.java:24) = = =20 at org.postgresql.Driver.makeConnection(Driver.java:393) = = =20 at org.postgresql.Driver.access $100(Driver.java:47) = =20 at org.postgresql.Driver $ConnectThread.run(Driver.java:308) = =20 at java.lang.Thread.run(Thread.java:619) = = =20 This is my little example java program. I have tried all commented-out versions you will see in the code. One astounding thing is that I get the same exceptions thrown when postmaster is not running. =20 To me it seems that the jdbc driver does not see the database *at all*. =20 How this can be, is a complete mystery to me. =20 My setup, which did not do any harm on the previous environment, may be flawed. =20 But one way or the other, I do not know how to proceed. =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = =20 wolfgang@pcwolfgang:~/programming/java/lotto$ cat jdbc_002_driverinfo.java =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = =20 import java.sql.*; = =20 import java.util.*; = =20 public class jdbc_002_driverinfo = =20 { = =20 public static void main( String args[] ) throws Exception =20 { = =20 Class.forName( "org.postgresql.Driver" ); = =20 //Connection conn =3D DriverManager.getConnection( "jdbc:postgresql:lotto", "wolfgang", "null" ); =20 //Connection conn =3D DriverManager.getConnection( "jdbc:postgresql://127.0.0.1:5432/lotto", "wolfgang", "" ); //String url =3D "jdbc:postgresql://localhost:5432/lotto"; String url =3D "jdbc:postgresql://127.0.0.1:5432/lotto"; Properties props =3D new Properties(); props.setProperty("user","wolfgang"); props.setProperty("password",""); props.setProperty("loglevel","2"); props.setProperty("socketTimeout","10"); props.setProperty("loginTimeout","10"); props.setProperty("tcpKeepAlive","true"); Connection conn =3D DriverManager.getConnection(url, props); DatabaseMetaData meta =3D conn.getMetaData(); System.out.println( "Produkt: " + meta.getDatabaseProductName() ); System.out.println( "Version: " + meta.getDatabaseProductVersion() ); System.out.println( "Anzahl erlaubter Verbindungen: " + meta.getMaxConnections() ); System.out.println( "Version des DB-Treibers : " + meta.getDriverVersion() ); System.out.println( "Update im Batchbetrieb : " + meta.supportsBatchUpdates() ); System.out.println( "Gespeicherte Prozeduren : " + meta.supportsStoredProcedures() ); conn.close (); } } Last, here is the extract of my postgresql configuration. Pretty much standard. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D pcwolfgang:~# grep ^[[:alpha:]] /etc/postgresql/8.4/main/postgresql.conf | cut -d"#" -f 1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D data_directory =3D '/var/lib/postgresql/8.4/main' hba_file =3D '/etc/postgresql/8.4/main/pg_hba.conf' ident_file =3D '/etc/postgresql/8.4/main/pg_ident.conf' external_pid_file =3D '/var/run/postgresql/8.4-main.pid' listen_addresses =3D 'localhost, 127.0.0.1' port =3D 5432 max_connections =3D 100 unix_socket_directory =3D '/var/run/postgresql' ssl =3D false shared_buffers =3D 24MB syslog_facility =3D 'LOCAL0' syslog_ident =3D 'postgres' client_min_messages =3D log log_min_messages =3D info log_min_error_statement =3D info log_line_prefix =3D '%t ' datestyle =3D 'iso, dmy' lc_messages =3D 'de_DE.UTF-8' lc_monetary =3D 'de_DE.UTF-8' lc_numeric =3D 'de_DE.UTF-8' lc_time =3D 'de_DE.UTF-8' default_text_search_config =3D 'pg_catalog.german' The database and all clients accessing it are strictly local. So, basically I have no access restrictions. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D pcwolfgang:~# grep -v ^$ /etc/postgresql/8.4/main/pg_hba.conf | grep -v ^# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D local postgres postgres trust local all postgres ident local all wolfgang trust host all wolfgang 127.0.0.1/32 trust host all wolfgang ::1/128 trust Any help is very much appreciated. Regards, Wolfgang Rinnert