• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

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.
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a tiny ad:
Become a Java guru with IntelliJ IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!