Nigel Thomas
Nigel Thomas

Reputation: 1929

Does force close of a Java application cause Database connection leakage

While running a Java application from NetBeans, and the application connects to a remote database, if we try to kill the application from NetBeans using the Stop button, will it cause a database connection leakage?

If so.. where should we set the properties to close all Database connections before killing the running instance of the application.

Upvotes: 1

Views: 661

Answers (1)

Christian Kuetbach
Christian Kuetbach

Reputation: 16060

There are two sides where a connection can be leaked.

Within the Java software:

You really can ignore this because the application will be killed soon.

Within the database:

This will cause problems, BUT every single network server application will check if a connection breaks away and free resources.

So I don't think you will get problems, because the database will mark the connections as invalid and free all resources.

Upvotes: 1

Related Questions