Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7964591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:55:35+00:00 2026-06-04T05:55:35+00:00

Will the Java JRE close database connections if an applications crashes or exits without

  • 0

Will the Java JRE close database connections if an applications crashes or exits without closing its active connections? If not is it the responsibility of the database to time out these connections?

I understand that if Java crashes then the database will need to time out all open connections as there is nothing else to do the job.

EDIT
Additional thought. If a WAR deployed in Tomcat crashes, will the Tomcat server cleanup the open connections?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:55:37+00:00Added an answer on June 4, 2026 at 5:55 am

    That really depends.

    If your JRE itself crashes, it might not be able to close all the connections. If just your application crashes, it might be able to close connections when it frees the resources. This seems to be the case most of the time, in my experience, as long as the JRE itself does not die. The best defence is of course proper error handling and making sure you do not have more connections open than required.

    From my experience, it’s better to set up a data source in Tomcat, that way, even if your application crashes, it’s not an issue with open resources. I’m a rather big fan of making my application server handle as much resource management as possible, that way I am protected a bit more from my sometimes adventurous code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Java applications may use IO streams, sockets or database connections that should be closed
Would like to make anapplication in Java that will not automatically parse parameters used
Will Java code built and compiled against a 32-bit JDK into 32-bit byte code
Please understand firstly that I fully understand that Java will return a String when
I have a general question with regards to immutable collections. I will use Java
As we all know Java program will start executing from the public static void
I need a mutable boolean field in Java (I will return this field via
Will the fact that java class files can be decompiled and need of third
I will be performing a lecture on Java for students of Physics, and I
I have a java program that will work with a variety of Java Beans.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.