• Post Reply Bookmark Topic Watch Topic
  • New Topic

closing connections obtained by JDBC Datasource look up  RSS feed

Ranch Hand
Posts: 77
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!