Re: Efficient Insert statement for one record into multiple

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Peter Neu <peter(dot)neu(at)gmx(dot)net>
Cc: <pgsql-jdbc(at)postgresql(dot)org>, "'Roland Walter'" <roland(dot)walter(dot)rwa(at)gmx(dot)net>
Subject: Re: Efficient Insert statement for one record into multiple
Date: 2006-12-19 11:09:47
Message-ID: 30DA21B9-0758-4A54-BC35-D955A2D95B83@fastcrypt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

If you create the key using nextval you will never get duplicate key
exceptions.

However, you should never close connections in the catch clause.
Always close connections in a finally clause.

Dave
On 19-Dec-06, at 5:18 AM, Peter Neu wrote:

> Hello,
>
> the insertion within the same connection objects works just fine. ;o)
> One thing which still keeps me thinking is how should I handle
> duplicate
> key exceptions when it happens in the first insert? Should I just
> close
> the connection object in the catch clause when this happens in the
> first
> statement so the second statement hits an
> AlreadyClosedConnectionException?
>
> Cheers,
> Pete
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that
> your
> message can get through to the mailing list cleanly
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Roman Chervotkin 2006-12-20 11:35:20 The column name x was not found in this ResultSet
Previous Message Markus Schaber 2006-12-19 11:03:52 Re: Efficient Insert statement for one record into multiple