Thread: ConnectionPool howto??

ConnectionPool howto??

From
"Dirk Bromberg"
Date:
Hi,

i'm new to postgres sql and jdbc..

i want to use a connection pool with 30 connections for my application
so now the questions:

1. where can i get a pool ?
2. when i've the pool and i get a connection who do i free it back to
the pool ?

thx
Dirk Bromberg


Re: ConnectionPool howto??

From
Dave Cramer
Date:
Dirk,

A connection pool is pretty easy to make.

Just create a class which keeps connections in a fifo linked list.

When you get a connection from the pool, first check to see if there is
on in the list, if there is then get it and return it to the caller, if
there isn't then if the number of connections is less than 30 open one
and return it to the caller.

You return connections to the pool, and place them at the tail of the
list assuming you are getting new connections from the head.

There are some other things you have to do, like close them all on a vm
shutdown, but for the most part what I have described will work just
fine


Dave

On Mon, 2003-02-17 at 15:45, Dirk Bromberg wrote:
> Hi,
>
> i'm new to postgres sql and jdbc..
>
> i want to use a connection pool with 30 connections for my application
> so now the questions:
>
> 1. where can i get a pool ?
> 2. when i've the pool and i get a connection who do i free it back to
> the pool ?
>
> thx
> Dirk Bromberg
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--
Dave Cramer <Dave@micro-automation.net>


Re: ConnectionPool howto??

From
Vernon Wu
Date:
On your way learning more Java server side development, you shall pick up a few versions of DB connection pool
implementions.


17/02/2003 12:45:21 PM, "Dirk Bromberg" <bromberg@tzi.de> wrote:

>Hi,
>
>i'm new to postgres sql and jdbc..
>
>i want to use a connection pool with 30 connections for my application
>so now the questions:
>
>1. where can i get a pool ?
>2. when i've the pool and i get a connection who do i free it back to
>the pool ?
>
>thx
>Dirk Bromberg
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>