tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kawthar Bt M Sulaiman" <>
Subject Re: Connection Pool setup.
Date Fri, 02 Apr 2004 08:54:19 GMT


I'd like to know how to implement connection pooling in my
This is what I had done so far.  Pls let me know what I need to change

to use the pooling mechanism.

1.  I created a singleton class: DatabaseOperations.
2.  It has an Connection instance: conn.
3.  During initialization, it gets connection as follows:
     DataSource ds  = (DataSource)
     conn = ds.getConnection();

4.  I have several public operations method (e.g selectOperations(...),
5.  Let's say I'd like to perform a select statement.  Inside my
     Statement stmt = conn.createStatement();
     ResultSet rs = stmt.executeQuery(...);
     <process the result>

     In my finally block, I have:

1.  Do I need to code any different to enable the connection pooling?

2.  When I called ds.getConnection(), does it opens up several
connections for pooling
     or just one connection?

3.  Do I need to close conn every time as well?  Since conn is an
     how does it gets connection everytime an operation method is
called? (insert, select, update).

That's all I have for now.  Thanks,

Confidential information may be contained in this e-mail and any files transmitted with it
('Message'). If you are not the addressee indicated in this Message (or responsible for delivery
of this Message to such person), you are hereby notified that any dissemination, distribution,
printing or copying of this Message or any part thereof is strictly prohibited. In such a
case, you should delete this Message immediately and advise the sender by return e-mail. Opinions,
conclusions and other information in this Message that do not relate to the official business
of Maxis shall be understood as neither given nor endorsed by Maxis.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message