Hi Sankar,
Thanks for reply. I am still not very clear abt Pooling funda.
Suppose the JDBC driver gives implementation of "ConnectionPoolDataSource"
and "PooledConnection". Application Server implements Connection Pool using
ConnectionPoolDataSource.
I presume that Application Server provides DataSource implementation.
When user says that
dataSource.getConnection();
internally App Server would do following things,
look for ConnectionPoolDataSource object;
PooledConnection pConn = ConnectionPoolDataSource.getPooledConnection();
pConn.addConnectionEventListener(listerObj);
return pooledConnection.getConnection();
So what does pooledConnection.getConnection() call return Physical
Connection or Proxy Connection?
I think if user invoke close() on physical connection then it will close
connection instead of returning it to the pool.
If proxy connection is returned then what is the use of "PooledConnection"
and "ConnectionPoolDataSource"?
If proxy connection is used then Application Server can always trap close()
call and maintain pool.
I will appreciate if you tell what were the driving forces for introducing
"ConnectionPoolDataSource" and "PooledConnection"?
---------------------------------------------------------------
Sun's API doc for Interface ConnectionEventListener says that
"A connection pooling component will usually be provided by a JDBC driver
vendor or another system software vendor."
Does this mean that event JDBC driver can give connection pooling component?
---------------------------------------------------------------
User always use DataSource object to get all types of Connection like normal
Connection, connection from Pool or XA Connection.
So does App Server implementation of DataSource return different types of
Connection depending upon settings given when configuring DS?
---------------------------------------------------------------
Thanks and Regards,
Alok
-----Original Message-----
From: sankara rao [mailto:Sankara.Rao@(protected)]
Sent: Thursday, November 20, 2003 2:54 PM
To: Alok_Band
Cc: A mailing list for Java(tm) 2 Platform, Enterprise Edition
Subject: Re: Connection Pooling doubts..
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
**************************************************************************
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)
of the message "signoff J2EE-INTEREST". For general help, send email to
listserv@(protected)".