This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
As we heard stealed connection's exists because of improper closing of connection in the application. so why cant we use static variables for Connection,ResultSet,Statement and close them using finalize method in my appllication instead of closing the connection in all the methods is it eliminates the stealed connection
A stale connection is caused by a timeout with the database. Making a connection a static variable increases the chance of a stale connection. Since the static variable lives for the life of the program, odds are that connection will experience a timeout sooner or later.