What Method and class used for Connection pooling ?

Answers were Sorted based on User's Feedback



What Method and class used for Connection pooling ?..

Answer / dsr

contex ic = new InitialContext();
DataSource sd = (datasource)ic.lookup("poolname");
Connection con = ds.getConnection();

Is This Answer Correct ?    2 Yes 0 No

What Method and class used for Connection pooling ?..

Answer / ravikiran(aptech mumbai)

datasource.
getDatasource.getconnection();

Is This Answer Correct ?    1 Yes 0 No

What Method and class used for Connection pooling ?..

Answer / qim2010

An application simply uses the DataSource.getConnection
method to get the pooled connection and uses it the same way
it uses any Connection object.

The classes and interfaces used for connection pooling are:

ConnectionPoolDataSource
PooledConnection
ConnectionEvent
ConnectionEventListener

The connection pool manager, a facility in the middle tier
of a three-tier architecture, uses these classes and
interfaces behind the scenes. When a
ConnectionPoolDataSource object is called on to create a
PooledConnection object, the connection pool manager will
register as a ConnectionEventListener object with the new
PooledConnection object. When the connection is closed or
there is an error, the connection pool manager (being a
listener) gets a notification that includes a
ConnectionEvent object.

Is This Answer Correct ?    1 Yes 0 No

What Method and class used for Connection pooling ?..

Answer / therathna

first to get the Context object by using given bellow

Context ic=new InitialContext();

And get DataSource object by using ic.lookup(conncetionpool
name)



your question is not proper way


DataSource Class & getConnection method is used
connection pool

Is This Answer Correct ?    0 Yes 0 No

What Method and class used for Connection pooling ?..

Answer / deepak divvela

InitialContext ctx=new InitialContext();
Obj obj=ctx.lookup("jmdi provided alias name here");
javax.sql.DataSource ds=(javax.sql.DataSource)obj;
Connection con=ds.getConnection();

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread

0 Answers  


What is the final class modifier?

0 Answers  


How many objects are created for a singleton class

7 Answers   Ness Technologies,


Is it necessary that each try block must be followed by a catch block?

0 Answers  


How many threads does a core java have?

0 Answers  






What are the differences between wait() and sleep()?

0 Answers  


What are parsers? Dom vs sax parser.

0 Answers  


How does a cookie work in Servlets?

0 Answers  


Name few java.lang classes introduced with java 8 ?

0 Answers  


Can an interface be final?

0 Answers  


What is the purpose of extern variable?

0 Answers  


How to sort double array in java?

0 Answers  


Categories