aspose file tools*
The moose likes JDBC and the fly likes Alternate way for  closing  connection ,statements  once we get the resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Alternate way for  closing  connection ,statements  once we get the resultset" Watch "Alternate way for  closing  connection ,statements  once we get the resultset" New topic
Author

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

santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
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

Creativity is nothing but Breaking Rules
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Any other way than what? I'm not sure I understand what you are asking?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
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

Joined: Mar 04, 2009
Posts: 477
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

Joined: Apr 20, 2006
Posts: 3344

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!?

Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Alternate way for closing connection ,statements once we get the resultset