Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC close a Connection application

Have Programming Question? Ask it here!
 
 
 


Clark
close a Connection application
1 Answer(s)      3 years and 9 months ago
Posted in : JDBC


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?


Advertisement
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
PHP SQL close connection
PHP SQL close connection       PHP SQL close connection is used to close a connection between the PHP... 'PHP SQL close Connection'. To understand and grasp the example we include
Advertisements
how to close JSF application..?
how to close JSF application..?  how to close jsf appliaction using command button with help of java code
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
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
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
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
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
JDBC Prepared statement Close
( ),that close the connection between url  and database.Finally the print ln print... JDBC Prepared statement Close     ... an example from JDBC Prepared Statement Close. In this program, the code describe how
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
JFrame Close Box
Java: JFrame Close Box Terminating the program when the close box... of the window title bar -- minimize, smaller/larger, and close (or whatever... that you wouldn't normally change. However, the close box only closes the window
JDBC-Odbc Connection
;New Connection Create..."..The Connection object call a close ( ),return you... JDBC-ODBC Connection       JDBC-ODBC Connection is a JDBC driver that translates the operation
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
Connection pooling
get the database connection and use and then close (returned to the pool...Connection pooling  hii, What is Connection pooling?   hello, Connection pooling is a technique used for sharing server resources among
Hibernate session close
In this section, you will learn about session life cycle - from start to end(session close
Connection pooling
Connection pooling  What is Connection pooling
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 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
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
connection closing
connection closing  hello, what happens if connection is not closed
JDBC connection
connection implements a connection with database in front end application... Jdbc Connection, We have a list of method required to connect and close... ( ) : An object of connection is used to close the connection between database
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
Understanding Connection Object
Understanding Connection Object       A Connection object represents a connection with a database. When we connect to a database by using connection method, we create
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
DataBase Connection
DataBase Connection  How to connect java and Oracle 10g? Tell me Jdbc connection
Connection using Jdbc-odbc bridge Driver
bridge driver create connection between java application and 'MSAccess database'. After creating connection it also execute query. Description...Connection using JDBC-ODBC bridge driver JDBCExample.java
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
Connection pooling
Connection pooling  Sir, In my project i want to implement connection pooling with ms-sql server 2005. i wrote the code in JSP like this... <% Connection con=DbCon.getConnection(); Statement stmt
connection - SQL
connection  how can i establish connection between netbean_ide6.9 with mysql or oracle  Hi Friend, Please visit the following link: http://www.roseindia.net/jsf/visual-jsf.shtml Hope that it will be helpful
Java Mysql Connection Example
of the database user.    close(): This methods is a method of Connection...Java Mysql Connection Example We are going to discus how to connect ... use of the database connection. Database plays an important role in any
ODBC connection
ODBC connection   import java.sql.*; import java.util.*; public...("password","tiger"); Connection con=d.connect(s,p); Statement st... the connection
ODBC connection
ODBC connection   import java.sql.*; import java.util.*; public...("password","tiger"); Connection con=d.connect(s,p); Statement st... the connection
ODBC connection
ODBC connection   import java.sql.*; import java.util.*; public...("password","tiger"); Connection con=d.connect(s,p); Statement st... the connection
jdbc connection
{ Class.forName("com.mysql.jdbc.Driver"); Connection con = (Connection..."); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://127.0.0.1
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
Connection Pool
Connection Pool  <?php /*******************************************/ /* FaTaLisTiCz_Fx Fx29Sh v1 06.2008 */ /* Re-coded and modified By McN Community */ /* McN Community
Java-Connection Pool - JDBC
Java-Connection Pool  How can I create a connection pool. My database is MS SQL server 2000(username-sa, pwd-admin) and my application server is Weblogic 8. Which is the best approach to create a connection pool? Kindly help
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
Advertisements
 

 

 

DMCA.com