Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 8B4DC633188 for ; Thu, 19 Feb 2009 12:46:53 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 30993-06 for ; Thu, 19 Feb 2009 12:46:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from arachne.itcomputers.cz (arachne.itcomputers.cz [81.0.234.91]) by mail.postgresql.org (Postfix) with SMTP id D5C4F63307D for ; Thu, 19 Feb 2009 12:46:41 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by arachne.itcomputers.cz (Postfix) with ESMTP id 4CCCA587F2B for ; Thu, 19 Feb 2009 17:46:40 +0100 (CET) X-Virus-Scanned: by amavisd-new 2.6.1 using ClamAV 0.94 at arachne.itcomputers.cz Received: from arachne.itcomputers.cz ([127.0.0.1]) by localhost (arachne.itcomputers.cz [127.0.0.1]) (amavisd-new, port 10024) with LMTP id sBFxl1-odmvL for ; Thu, 19 Feb 2009 17:46:40 +0100 (CET) Received: from localhost.localdomain (platan.ispromotion.cz [81.0.234.89]) by arachne.itcomputers.cz (Postfix) with SMTP id 0DBAE5881E0 for ; Thu, 19 Feb 2009 17:46:39 +0100 (CET) Received: from phpmailer ([195.80.177.66]) by mail.infoweb.cz with HTTP (Apache/2.2.11 (Gentoo) mod_ssl/2.2.11 OpenSSL/0.9.8j PHP/5.2.8-pl2-gentoo with Suhosin-Patch); Thu, 19 Feb 2009 17:46:06 +0100 Date: Thu, 19 Feb 2009 17:46:06 +0100 To: "" From: "" Subject: SocketException: Connection reset X-Priority: 3 X-Mailer: phpmailer [version 1.50] X-MSMail-Priority: Medium Importance: Medium MIME-Version: 1.0 Content-Type: text/plain; charset = "iso-8859-2" Message-Id: <20090219164640.0DBAE5881E0@arachne.itcomputers.cz> Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=3.33 tagged_above=0 required=5 tests=FROM_BLANK_NAME=2.212, MISSING_MIMEOLE=0.001, RCVD_IN_SORBS_WEB=1.117 X-Spam-Level: *** X-Archive-Number: 200902/29 X-Sequence-Number: 19304 Hi, my problem is simple, but frustrating for me: JDBC driver: postgresql-8.3-604.jdbc4.jar Server: PostgreSQL 8.3.5, compiled by Visual C++ build 1400 Code (found cause, so very simplified): public class Main { public static void main(String[] args) throws Exception { java.util.Properties props =3D new java.util.Properties(); props.setProperty(\"user\", \"postgres\"); props.setProperty(\"password\", \"secretpassword\"); for (int i =3D 0; i < 100; i++) { System.out.println(\"attempt number \" + i); java.sql.Connection con =3D java.sql.DriverManager.getConnection( =20 \"jdbc:postgresql://localhost:5432/my\", propsDB); con.close(); } } } Code produces (... for abbreviation): run: attempt number 0 attempt number 1 ... attempt number 68 attempt number 69 Exception in thread \"main\" org.postgresql.util.PSQLException: The connection attempt failed. at org.postgresql.Driver$ConnectThread.getResult(Driver.java:341) at org.postgresql.Driver.connect(Driver.java:264) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:154) at sometests.Main.main(Main.java:85) Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:168) at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedIn= putStream.java:135) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBuffere= dInputStream.java:104) at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputS= tream.java:73) at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:259) at org.postgresql.core.v2.ConnectionFactoryImpl.doAuthentication(ConnectionF= actoryImpl.java:207) at org.postgresql.core.v2.ConnectionFactoryImpl.openConnectionImpl(Connectio= nFactoryImpl.java:76) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.ja= va:66) at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connecti= on.java:124) at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connecti= on.java:30) at org.postgresql.jdbc4.AbstractJdbc4Connection.(AbstractJdbc4Connecti= on.java:29) at org.postgresql.jdbc4.Jdbc4Connection.(Jdbc4Connection.java:24) at org.postgresql.Driver.makeConnection(Driver.java:386) at org.postgresql.Driver.access$100(Driver.java:47) at org.postgresql.Driver$ConnectThread.run(Driver.java:301) at java.lang.Thread.run(Thread.java:619) Java Result: 1 Sometimes it happens after just 8 attempts, sometimes after 80, sometimes after 780 attempts. I googled for some time, no solution found. Thank you for any suggestions. z --- =3D=3D=3D www.INFOWEB.cz =3D=3D=3D ---