Re: Another exception (Transaction level) - Mailing list pgsql-jdbc

From Csaba Nagy
Subject Re: Another exception (Transaction level)
Date
Msg-id 1059143024.10668.24.camel@coppola.ecircle.de
Whole thread Raw
In response to Re: Another exception (Transaction level)  (Ole Streicher <ole-usenet-spam@gmx.net>)
List pgsql-jdbc
>  > Concurrently? Do you mean that you a sharing one connection between
>  > several threads?
>
> Yes. I didn't see a hint why this should be problematic.

You should use a connection pool: open a few connections beforehand, and
each thread can then request one for it's exclusive use, and then give
it back after finishing. There are lots of possible
strategies/variations you could apply to the nr. of initial connections,
how to grow/shrink that depending on load, what happens if there are too
many connections open and there's a new connection (you can wait or
throw exception), etc.
Google around or search this list for "connection pool" and I'm sure
you'll find a lot of hints and code examples.

Cheers,
Csaba.



pgsql-jdbc by date:

Previous
From: Ole Streicher
Date:
Subject: Re: Another exception (Transaction level)
Next
From: Tom Lane
Date:
Subject: Re: Another LargeObject problem