pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: Nico <nicohmail-postgresql@yahoo.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: PSQLException instead of java.net.SocketException
Date: Sun, 02 Jan 2005 08:20:51 -0500
Message-ID: <41D7F533.10003@fastcrypt.com> (raw)
In-Reply-To: <cr8r9n$1v2p$1@news.hub.org>
References: <cr8r9n$1v2p$1@news.hub.org>

Nico,

PSQLException will/should store the cause internally, you should be able 
to get the cause out of it and act appropriately.

Dave

Nico wrote:

>Each time I initiate my servlet, I get an exception. It is thrown when I 
>call the executeQuery method of a statement instance. He throws a 
>PSQLException. However, when I take a look at the stack trace, it appears to 
>be a java.net.SocketException was thrown. My best guess is the exception was 
>catched and a PSQLException was thrown in the catch block. I already have a 
>catch block for PSQLException which is designed to warn me for SQL syntax 
>errors, not socket exceptions. So I want to make an additional catch block 
>for a java.net.SocketException. However I don't know how. Can someone please 
>help me here?
>Reason I want to do this: I can't solve sql syntax errors automatically, but 
>I can solve socketexceptions automatically by just refreshing the window on 
>the client side. However if someone can solve the cause in stead of the 
>catching exception, that's even better.
>here is the exception:
>An I/O error has occured while flushing the output - Exception: 
>java.net.SocketException: Socket closed
>here is part of the stack trace:
>java.net.SocketException: Socket closed
> at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99)
> at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
> at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
> at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
> at org.postgresql.PG_Stream.flush(PG_Stream.java:352)
> at org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:159)
> at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:70)
> at 
>org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:505)
> at 
>org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:320)
> at 
>org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
> at 
>org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:153)
> at 
>org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:141)
> at menus.DBMenu.getQuery(DBMenu.java:705)
> at menus.DBMenu.Menupage(DBMenu.java:165)
> at menus.DBMenuShow.doGet(DBMenuShow.java:132)
>
>Nico. 
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>
>  
>

-- 
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561




view thread (3+ messages)  latest in thread

Message-ID: <41D7F533.10003@fastcrypt.com>
Permalink:  ../41D7F533.10003@fastcrypt.com/
Also on:    postgresql.org/message-id/41D7F533.10003@fastcrypt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: pg@fastcrypt.com, nicohmail-postgresql@yahoo.com
  Subject: Re: PSQLException instead of java.net.SocketException
  In-Reply-To: <41D7F533.10003@fastcrypt.com>
  References: <cr8r9n$1v2p$1@news.hub.org> <41D7F533.10003@fastcrypt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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