Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Alternate way for closing connection ,statements once we get the resultset

 
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
As we know once the connection has been established and statement get created and execute the query untill the result set get closed we cant close the statement and connection is there any other way to close the connection and statement after the statement.executeQuery() method has been called
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any other way than what? I'm not sure I understand what you are asking?
 
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Santhosh,

You should close the resultset after execution in order to avoid memory leaks.

why you are trying to avoid closing of resultset any other business requirement ?
 
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Didn't get your question!
close() method closes statements and connections. You can close Statement anytime you want... right? All you have to do is put it in the code when you want to close it!
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

santhosh.R gowda wrote:Dear all,
As we know once the connection has been established and statement get created and execute the query untill the result set get closed we cant close the statement and connection is there any other way to close the connection and statement after the statement.executeQuery() method has been called



Santhosh,

I think your query is NOT legible. Even after reading three times, I could not come to a conclusion on what you would be in need of?

1. Do you like to close the connection alone without closing the resultset? (based on the very first line).
2. Do you intend to close the connection and resultset objects without using close() method? -- as what the title of the post speaks out and others have understood and tried answering!?
 
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad:
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/730700/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic