• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

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

 
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic