close a Connection application

What happens when I close a Connection application obtained from a connection Pool? How does a connection pool maintain the Connections that I had closed through the application?

View Answers

November 15, 2010 at 10:33 AM

Hi friends,

It is the magic of polymorphism, and of Java interface vs. implementation types. Two objects can both be "instanceof" the same interface type, even though they are not of the same implementation type.

When you call "getConnection()" on a pooled connection cache manager object, you get a "logical" connection, something which implements the java.sql.Connection interface.

But it is not the same implementation type as you would get for your Connection, if you directly called getConnection() from a (non-pooled/non-cached) datasource.

So the "close()" that you invoke on the "logical" Connection is not the same "close()" method as the one on the actual underlying "physical" connection hidden by the pool cache manager.

The close() method of the "logical" connection object, while it satisfies the method signature of close() in the java.sql.Connection interface, does not actually close the underlying physical connection.

Thanks.









Related Tutorials/Questions & Answers:
close a Connection application
close a Connection application  What happens when I close a Connection application obtained from a connection Pool? How does a connection pool maintain the Connections that I had closed through the application
how to close JSF application..?
how to close JSF application..?  how to close jsf appliaction using command button with help of java code
Advertisements
PHP SQL close connection
PHP SQL close connection       PHP SQL close connection is used to close a connection between the PHP... an example from 'PHP SQL close Connection'. To understand and grasp the example
Correctly Open and Close database connection
; } Completely Open and Close A Database Connection Database Connection... and close database connections properly. If any database connection is open... important to close the database connection after it is used. Database connection
Tag In Project POM To Close My Java Application If JRE 1.6 Is Not Found?
Tag In Project POM To Close My Java Application If JRE 1.6 Is Not Found?  I have an application compiled in Java. I build my code through Maven. I... run-time, it should not allow my Java application to launch. Can I get any
how to close the connection object,statement object,resultssetobject when using the microsoft access a database - SQL
how to close the connection object,statement object,resultssetobject when using the microsoft access a database   Hi Friend, I am developing... file. How to close the conection objects,resultset object.objects are increaseing
can modify this application connection with database
can modify this application connection with database   hi i'm want... to Java Frame, in here can i ask one more question about using this application modify connection with database ? import javax.swing.*; import java.applet.
Regarding connection between sqlserver 2005 and android application
Regarding connection between sqlserver 2005 and android application  hi to all, i want to know how to create webservice to connect sqlserver 2005 and android. can you please help me by providing source code for ref.. thanks
Connection
Connection  What is Connection
connection
connection   how to make multiple database connection using jdbc
connection
the connection with the available port on the host machine: import java.net.... the connection was not established. Predict the output of the preceding code. Explain why the connection cannot be established
Close Cursors in SQL
Close Cursors in SQL       Close Cursors is used to close the Cursor temporary, when the open cursor is not required. The keyword close in cursor release the current records
How to close R Console?
write and test R Programs here. If you wish to close the session then type: q...How to close R Console?  Hi, I am inside R console. How to close R... that if will close the R Console session. Hope this helps you. Thanks   Hi, We
why cant i close this ??
why cant i close this ??  import java.util.Scanner; public class square { public static void main ( String [] args) { Scanner keyboard = new Scanner (System.in); int N; N = keyboard.nextInt
JDBC Prepared statement Close
( ) :The prepared statement object call close ( ),that close the connection between... JDBC Prepared statement Close     ... illustrates you an example from JDBC Prepared Statement Close. In this program, the code
JDBC-Odbc Connection
object call a close ( ),return you the connection is closed. The println... JDBC-ODBC Connection       JDBC-ODBC Connection is a JDBC driver that translates the operation
To put a "close window" link on a page?
To put a "close window" link on a page?  To put a "close window" link on a page
Close Cursors in SQL
Close Cursors in SQL       Close Cursors is used to close the Cursor temporary, when the open cursor is not required. The keyword close in cursor release the current records
what is the use of Hibernate Sessionfactory close() method?
what is the use of Hibernate Sessionfactory close() method?  hi, What is the use of of Hibernate Sessionfactory close() method? Thanks..   Hello, Close() method of Hibernate Sessionfactory destroys the SessionFactory
Close Cursors in SQL
Close Cursors in SQL       Close Cursor is used to close the cursor temporary when it is not required. A cursor in a SQL can be closed with close
ModuleNotFoundError: No module named 'read-and-close'
ModuleNotFoundError: No module named 'read-and-close'  Hi, My... named 'read-and-close' How to remove the ModuleNotFoundError: No module named 'read-and-close' error? Thanks   Hi, In your python
Java file close
Java file close This section demonstrates you the use of close() method.... You can done this using the method close(). This method automatically flush out the stream. It is necessary to close the stream after performing any file
Protractor close browser after test
Protractor close browser after test  Hi, I am writing test cases... to session related issues. I want to close and start browser. How to restart browser? I need to know the code for Protractor to close browser after test
Connection pooling
and then close (returned to the pool) it. Popular connection pooling software in Java...Connection pooling  hii, What is Connection pooling?   hello,ADS_TO_REPLACE_1 Connection pooling is a technique used for sharing server
JDBC connection
connection implements a connection with database in front end application... to connect and close the connection. Before the implementation of class we need...; con.close ( ) : An object of connection is used to close the connection
ModuleNotFoundError: No module named 'odoo13-addon-l10n-ro-account-period-close'
ModuleNotFoundError: No module named 'odoo13-addon-l10n-ro-account-period-close...: ModuleNotFoundError: No module named 'odoo13-addon-l10n-ro-account-period-close...-account-period-close' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'gitlab-auto-close-issue'
ModuleNotFoundError: No module named 'gitlab-auto-close-issue'  Hi...: No module named 'gitlab-auto-close-issue' How to remove the ModuleNotFoundError: No module named 'gitlab-auto-close-issue' error? Thanks   
ModuleNotFoundError: No module named 'odoo11-addon-l10n-ro-account-period-close'
ModuleNotFoundError: No module named 'odoo11-addon-l10n-ro-account-period-close...: ModuleNotFoundError: No module named 'odoo11-addon-l10n-ro-account-period-close...-account-period-close' error? Thanks   Hi, In your python
Hibernate session close
In this section, you will learn about session life cycle - from start to end(session close
Setting the close button operation for the frame in Java
will learn how to implement the close button of any frame or window in java application. By default the close button of the frame is not in working state. If you... Setting the close button operation for the frame in Java
Understanding Connection Object
. This method is used to close all the connection. Firstly we need... Understanding Connection Object       A Connection object represents a connection
Connection using Jdbc-odbc bridge Driver
program, Jdbc-Odbc bridge driver create connection between java application... object "res". con.close();-- It is used to close the connection open...Connection using JDBC-ODBC bridge driver JDBCExample.java
JFrame Close On Button Click
JFrame Close On Button Click In this section we will discuss about how to close frame on click on the button. This example explains you how a frame can be closed on an action event i.e. a frame should be close when clicked
Connection pooling
Connection pooling  What is Connection pooling
Java Mysql Connection Example
; close(): This methods is a method of Connection interface used for releasing...Java Mysql Connection Example We are going to discus how to connect ... use of the database connection. Database plays an important role in any
how can i close a frame. - Java Beginners
how can i close a frame.  Hi, My question is how can we close a frame when an action is taken......For example let us think that we have a frame and in that table is displayed and one button is added to that frame
Connection to Database
Connection to Database  Hello, I have a website with more than 50.... However, most of times my web pages displays the error message" Too many Connection... and viewing hundreds of pages, I wont get any connection error and the truth
connection closing
connection closing  hello, what happens if connection is not closed
Database Connection Pooling (DBCP)
and quicker response using the available connections as making new connection is very... within a giant database application. The database enabled applications needs the database connection for processing the request send by the clients
DataBase Connectivity with MySql in Visual Web JSF Application Using Net Beans IDE
. In this application, we are going to create a database connection with mysql step...DataBase Connectivity with MySql in Visual Web JSF Application Using Net Beans...;  This Application illustrates how to create database
Interact with connection pools to obtain and release connections
cases, the connection does not close until the application closes it. ADS... Your application always maintains a direct link with a physical connection (managed... connection. If you always close your connection handle before getting another
Establish a Connection with MySQL Database
Establish a Connection with MySQL Database   ... coding methods of establishing the connection between MySQL database and quartz application for updating and manipulating the data of MySQL database tables. Here
how can i close particular frame in swings - Java Beginners
how can i close particular frame in swings  Hi, I want to know, how can we close a particular frame when mulitple frames are appearing as output when clcking close button. let us assume that we got three frames as output
should close the browser with user confirmation in javascript - Java Beginners
should close the browser with user confirmation in javascript  Hi, I need to close the browser with the user confirmation. If the user accept olny he/she can close the browser otherwise can't close the browser. How can I do
DataBase Connection
DataBase Connection  How to connect java and Oracle 10g? Tell me Jdbc connection
connection - JNDI
connection   Hi, i am getting this error,can any one know pls give me reply org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool exhausted  Hi friend, Plz give full details with source
ModuleNotFoundError: No module named 'odoo10-addon-web-confirm-window-close'
ModuleNotFoundError: No module named 'odoo10-addon-web-confirm-window-close...: ModuleNotFoundError: No module named 'odoo10-addon-web-confirm-window-close' How...-window-close' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'odoo10-addon-web-confirm-window-close'
ModuleNotFoundError: No module named 'odoo10-addon-web-confirm-window-close...: ModuleNotFoundError: No module named 'odoo10-addon-web-confirm-window-close' How...-window-close' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'github-bot-close-inactive-issues'
ModuleNotFoundError: No module named 'github-bot-close-inactive-issues' ...: ModuleNotFoundError: No module named 'github-bot-close-inactive-issues' How to remove the ModuleNotFoundError: No module named 'github-bot-close-inactive-issues'
ModuleNotFoundError: No module named 'odoo8-addon-account-journal-period-close'
ModuleNotFoundError: No module named 'odoo8-addon-account-journal-period-close...: ModuleNotFoundError: No module named 'odoo8-addon-account-journal-period-close' How...-journal-period-close' error? Thanks   Hi, In your python