X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CB5DF9DD77B for ; Fri, 9 Dec 2005 16:34:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97019-07 for ; Fri, 9 Dec 2005 16:34:29 -0400 (AST) X-Greylist: delayed 00:25:11.284219 by SQLgrey- Received: from mail.sqlpower.ca (mail.sqlpower.ca [216.123.188.162]) by postgresql.org (Postfix) with ESMTP id B866F9DD777 for ; Fri, 9 Dec 2005 16:34:26 -0400 (AST) Received: by mail.sqlpower.ca (Postfix, from userid 1003) id 7700029A4F0; Fri, 9 Dec 2005 15:09:12 -0500 (EST) Received: from [192.168.1.100] (sub-etha.sqlpower.ca [192.168.0.9]) by mail.sqlpower.ca (Postfix) with ESMTP id 25EBD29A4CA; Fri, 9 Dec 2005 15:09:09 -0500 (EST) In-Reply-To: <6f1412eb0512081358u4d699f2bx32d722e92fd5cf54@mail.gmail.com> References: <6f1412eb0512081358u4d699f2bx32d722e92fd5cf54@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: multipart/alternative; boundary=Apple-Mail-5--914558124 Message-Id: <385133ace3c5280b1b2df75125cd520a@sqlpower.ca> Cc: pgsql-jdbc@postgresql.org From: Jonathan Fuerth Subject: Re: org.postgresql.util.PSQLException: An I/O error has occured while flushing the output Date: Fri, 9 Dec 2005 15:09:08 -0500 To: Kishore Kolli X-Mailer: Apple Mail (2.623) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/48 X-Sequence-Number: 14379 --Apple-Mail-5--914558124 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed On Dec 8, 2005, at 4:58 PM, Kishore Kolli wrote: > =A0The application dumps the following error in the following cases: > =A0=A0 1. The postgres process is restarted. > =A0=A0 2. The network connection between the machine running postgres = and=20 > tomcat has been reset. > [...]=A0 > Any idea how to make tomcat reconnect to the database with out any=20 > problems ? > =A0 It's not a Postgres specific answer, but here's an answer nonetheless: It appears from the stack trace that you are using the Jakarta Commons=20= DBCP package. If you set a validationQuery on your connection pool,=20 the pool manager will automatically test your database connections=20 before giving them to Hibernate. If you have had a network outage or=20 server restart, the pooled connections will fail that test, and the=20 DBCP will dump those broken connections and open new ones before=20 returning them to Hibernate. For your validation, pick a simple query that is guaranteed to return=20 at least one row, but will not be expensive to execute (because it will=20= be executed frequently!). For example, you could use "SELECT now()",=20 which doesn't even require disk access. See http://jakarta.apache.org/commons/dbcp/configuration.html for=20 details on DBCP configuration. -Jonathan= --Apple-Mail-5--914558124 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 On Dec 8, 2005, at 4:58 PM, Kishore Kolli wrote: Arial=A0The application dumps the following error in the following cases: Arial=A0=A0 1. The postgres process = is restarted. Arial=A0=A0 2. The network = connection between the machine running postgres and tomcat has been = reset. [...]=A0 ArialAny idea how to make tomcat reconnect to the database with out any problems ? =A0 It's not a Postgres specific answer, but here's an answer nonetheless: It appears from the stack trace that you are using the Jakarta Commons DBCP package. If you set a validationQuery on your connection pool, the pool manager will automatically test your database connections before giving them to Hibernate. If you have had a network outage or server restart, the pooled connections will fail that test, and the DBCP will dump those broken connections and open new ones before returning them to Hibernate. For your validation, pick a simple query that is guaranteed to return at least one row, but will not be expensive to execute (because it will be executed frequently!). For example, you could use "SELECT now()", which doesn't even require disk access. See http://jakarta.apache.org/commons/dbcp/configuration.html for details on DBCP configuration. -Jonathan= --Apple-Mail-5--914558124--