*
The moose likes Java in General and the fly likes closing connections obtained by JDBC Datasource look up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "closing connections obtained by JDBC Datasource look up" Watch "closing connections obtained by JDBC Datasource look up" New topic
Author

closing connections obtained by JDBC Datasource look up

Mohamed Iqzas
Ranch Hand

Joined: Jan 02, 2012
Posts: 61

Hi,

For the first time I have configured my local JBoss 7 AS for JNDI Datasource Look up.

I blindly followed instructions given in jboss forums and it worked well for me.

But if my web application is inactive for a long time and if i try login to my application new datasource lookup is working fine.

for every login my application will make a DS lookup and jdbc connection calls are working fine. But in the next page I am using a servlet that uses one connection instance to serve all the requests. Now it is not making a new DS lookup and the old connection created during servlet instantiation is being used. So now I have to restart my server to instantiate this servlet again. I am making a ds look up call in the init method of my servlet. I thought its a good way of doing but it is causing problems if the servlet is inactive for very long time .. I guess the connection is getting closed. Do I have to create a connection everytime inside service methods instead of doing it in init() method? or I have to change something else?

Thanks in advance.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: closing connections obtained by JDBC Datasource look up