Hello,
I read lots of people saying that having dB connection initialized in 'init' section of a
java code is not dependable, for the connection may be lost at any time. Instead suggested using a connection pool.
Can I implement a solution for this as outlined below:
1. create a connection in 'init' section.
2. Use this connection for rest of the requests until the connection is broken.
3. When a request is served I use "con.createStatement()" to get the result. During this time if I can not get the connection, then in 'catch' section I will create a new connection for the rest of the life of the
servlet until the connection got broken again.
What is wrong doing this way? Can any one tell me if this will work or not?
Thanks in advance.
Suresh Kanagalinagm