Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
santhosh.R gowda
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
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate 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?
 
Meet Gaurav
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 ?
 
Somnath Mallick
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!
 
Raghavan Muthu
Ranch Hand
Posts: 3381
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!?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic