Hi,

> Who told you that the JDBC connection should not be done at init() method? If you do 
>it anywhere else, it is not possible to get a persistent connection.

This thread has more or less died. The question was with respect
creating "a" connection, and trying to use it in other methods. This
would lead to transaction issues with different requests trying to use
the same connection.

> If you are going to use conection pooling also, the object of the class that is 
>going to make a db connection should be created inside the init() method.

Connection pooling is a different issue - and since the pool is required
to take of returning unique connections for each requester, initializing
the pool in the init/constructor is not an issue.

> Note: In connection pooling , instead of having a single connection being shared 
>between the multiple threads, a pool say around 5 connections are created and given 
>to the threads on demand. The connections are maintained in a hash. When a request 
>arises when all the connections are used up, a new connection will be generated and 
>added to the hash. Once a thread finishes its job, it will return the connection to 
>the hash by setting it to be in free state.

FYI, a better alternative to this kind of connection pooling is to rely
on a J2EE app server using datasources and connections of JDBC2.0.

Cheers.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to