• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC connection closing problem in Servlets

 
Vikram Anand
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my code I open the connection in the init() method of the servlet and close it in the destroy method.
after some inputs to the database the database returns a error telling the connection is already in use with stmt already in use.
i am using sql server with jdbc-odbc.
plz help
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably need to see your Servlet Code before anyone can help you.
 
Narendra Kamaraju
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
narendra.kamaraju@oracle.com

Hi Vikarm,
After creating the conneciton in the init() method,if you start invoking the servlet repeatedly over a period of time,it is going to open a cursor for each statement that you execute.Any database connection will have ceiling on maximum number of open cursors that it maintain for a single connection.Make sure that you close the statement and resultset once you are done with your work.
If you post your code here,I can tell you what exactly needs to be done.

Best of luck,
Cheers,
Narendra.
[ July 11, 2002: Message edited by: Narendra Kamaraju ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Narendra Kamaraju:
narendra.kamaraju@oracle.com

Um, yeah. 'cos that helps
Generally we try to encourage people to discuss solutions on the boards so that others can benefit from the solutions too. If you find it's something that you want to work over privately, that's fine, but it ends up helping one person rather than, um, lots.
 
Narendra Kamaraju
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David O'Meara:

Um, yeah. 'cos that helps
Generally we try to encourage people to discuss solutions on the boards so that others can benefit from the solutions too. If you find it's something that you want to work over privately, that's fine, but it ends up helping one person rather than, um, lots.


Hi David,
It was not intentional to post the query without any content.I have edited my post immediately to correct my mistake.
Sorry once again.
Regards,
Narendra
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic