> From: sinoea kaabi [mailto:[EMAIL PROTECTED]
> Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active
> connections keepincreasing....
>
> I could accept the fact that we should create new objects of Dao's,
> but for getting a datasource or connection it should make sense
> to have a utility class with static methods.

Absolutely - Johnny K's suggestion of doing a new every time is utter nonsense.

> So is a connection a thread-safe object or not?

No, a connection is not thread-safe: it is designed to be be used by only one 
thread at a time.  If you have multiple threads accessing a connection object 
*simultaneously*, you will have problems.  On the other hand, connection 
managers (e.g., the commons-dbcp code) are thread-safe; multiple threads may 
call one simultaneously to acquire connection objects, and each thread is 
guaranteed to be given a separate object.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to