This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Init block in servlet and jdbc connection

 
Srinivasa Dhamodharan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! all,
In one of my Servlets if I have the JDBC connection in the doget method it connects and the connection stays till the program completion, But if I have it in the servlets init block,
and do some database operation in the doget method , the connection is lost and the connection pointer is pointing to null,
Can anybody tell me why is this happening.
Thanks in Advance
 
Pragya Prakash
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In all probability, the connection variable is going out of scope.
Check for the scope of the variable.
If that is alright, then I could help you if u give additional input and the code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic