Solved

java.sql.Statement lifecycle

Posted on 2001-09-18
4
247 Views
Last Modified: 2006-11-17
a Connection object creates a Statement object (connection.createStatement())

but what if that connection later dies (say the database falls over)  what happens to the Statement object?
will it stay around to cause trouble or does it dissapear along with its connection?

regards,
John

JohnSenford@hotmail.com
0
Comment
Question by:johnsenford
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 92

Accepted Solution

by:
objects earned 50 total points
ID: 6490066
It should get closed, when the connection is closed.
But you really should close statements once you're done with them, as well as closing ResultSet's.
0
 

Author Comment

by:johnsenford
ID: 6490324
of course you should close them, but I was thinking of the scenario whereby you didn't anticipate the connection being closed in the first place (it wasn't an explicit closure)
0
 

Expert Comment

by:ManojShetty
ID: 6491001
If a connection is closed then automatically all resultsets & statements associated with the connection also get closed.
0
 
LVL 20

Expert Comment

by:Venabili
ID: 8916416
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points for objects

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Venabili
EE Cleanup Volunteer
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jsp login check 12 64
Is Applet the way to go for my drag and drop system? 8 51
Html Table Looping (part 2) 5 41
Eclipse neon2 "Java build path" correctness 7 43
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question