Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » J2EE Interest »

Re: Connection Pooling doubts..

sankara rao

2003-11-20

Replies:

Alok_Band wrote:
> Hi Sankar,
>
> Thanks for reply.
>
> You mean that if "ConnectionPoolDataSource" object is used then user would
> get Physical Connection otherwise it would get another class derived from
> Connection.

 I would not say user will get a physical connection if "ConnectionPoolDataSource" is specified, you may get a Connection object implemented by the
JDBC driver implementor (In this case, the one who implemented ConnectionPoolDataSource). Otherwise you might get a Connection object proxied by the
Application Server developer.

>
> Let me give my understanding, plz correct me if I am wrong,
>
> JDBC driver would provide Connection implementing "PooledConnection"
> interface. Connection Pooling software(provided by Application Server) would
> provide a object implementing "ConnectionEventListener" interface and invoke
> register with Connection object returned by JDBC Driver.
>
> When user invokes conn.close() then ConnectionEventListener object would be
> intimated.
>
> "ConnectionPoolDataSource" object is used only to return "PooledConnection"
> objects instead of "Connection" object as returned by "DataSource".
>
> So to implement connection pool in this fashion JDBC driver must give
> implementation of "PooledConnection" and "PooledConnectionDataSource".

Yes. Your interpretation is correct.

>
>
> Regards,
> A;pl
>
>
>
>
>
>
>
> -----Original Message-----
> From: sankara rao [mailto:Sankara.Rao@(protected)]
> Sent: Wednesday, November 19, 2003 5:24 PM
> To: A mailing list for Java(tm) 2 Platform, Enterprise Edition; Alok_Band
> Subject: Re: Connection Pooling doubts..
>
> Hi Alok,
>
>   Find the answers inline.
>
> regards
> sankar
>
> Alok_Band wrote:
>
>>Hi,
>>
>>
>>
>>I have basic doubts about Connection Pooling,
>>
>>
>>
>>Interface DataSource -
>>
>>    Sun's java doc says that Driver Vendor implement this interface.
>>
>>
>>
>>My doubts is who implements Connection Pooling mechanism? Driver Vendor
>>or Application Server?
>>
>
>     Application Server.
>
>
>>
>>
>>What is the use of ConnectionPoolDataSource interface? I read that
>>Application Server uses this interface but don't know how?
>
>     ConnectionPoolDataSource is the connection pool enabling
> infrastructure. To realize that, let us take this piece of code.
>
>       java.sql.Connection conn = ds.getConnection();
>       // do some thing with the conn
>       conn.close();
>
>       In this case, ConnectionPoolDataSource will inform the Application
> Server is that, user has called close() on Connection and then AppServer
> might decide to pool that connection. If ConnectionPoolDataSource is not
> available, then instead of the original connection given by the database
> driver will be proxied and given to the user.
>
>
>>
>>
>>I read that JTA enabled JDBC Driver implements XAConnection,
>>XADataSource, XAResource interfaces.
>>
>>
>>
>>Does it mean that it is the responsibility of Driver Vendor to provide
>>ResourceManger(object implementing XAResource) supporting XA/Open
>>standard to communicate with Transaction manager?
>
>
>   From XADataSource, you could get XAConnection and from that you get,
> XAResource but all that job is appserver's job and you only provide
> XADataSource and get and use the connection in the normal way.
>
>
>>
>>
>>But then what is the use of DataSource interface if JDBC Driver is
>>giving XAResource object?
>>
>>
>>
>>I have always used DataSource object to get connection. How XAResource
>>come in picture? Does it mean that ApplicationServer would internally
>>refer to XAResource (given by JDBC Driver) when JTA connection is
>
> requested?
>
>  Explained above.
>
>
>>
>>
>>Which one is the Resource Manager for DB DataSource,
>>ConnectionPoolDataSource or XAResource? Are there any J2EE specification
>>for implementing DB Connection Pool?
>
>
>   There is no specification for implemneting the connection pool. Basic
> difference between normal DataSource and ConnectionPoolDataSource is that,
> the latter is everything of former plus connection enabling infrastructure.
> XADataSource is everything of ConnectionPoolDataSource plus the
> implementation of XA part.
>
> Please let me know if something is not clear. I try to answer.
>
>
>>
>>
>>Thanks in Advance
>>
>>
>>
>>Regards,
>>
>>Alok
>>
>>**************************************************************************
>>
>>This email (including any attachments) is intended for the sole use of
>>the intended recipient/s and may contain material that is CONFIDENTIAL
>>AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or
>>copying or distribution or forwarding of any or all of the contents in
>>this message is STRICTLY PROHIBITED. If you are not the intended
>>recipient, please contact the sender by email and delete all copies;
>>your cooperation in this regard is appreciated.
>>
>>**************************************************************************
>>
>>
>
> ===========================================================================
>
>>To unsubscribe, send email to listserv@(protected)
>>body of the message "signoff J2EE-INTEREST". For general help, send
>>email to listserv@(protected)
>>"help".
>>
>
>
>


--
Every great movement must experience three stages:
            ridicule, discussion, adoption.

    --    John Stuart Mill

===========================================================================
To unsubscribe, send email to listserv@(protected)
of the message "signoff J2EE-INTEREST". For general help, send email to
listserv@(protected)".


©2008 junlu.com - Jax Systems, LLC, U.S.A.