[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Using Connection Pools across sessions
|
Hi Rohit,
I am glad you have been able to find some information about UCP.
The internal connection pool is currently designed to be used by a single
session. Altering it to make it usable by multiple sessions would require a
significant amount of work and testing - work that is much better done by
Connection Pool Experts such as the team that develops UCP.
-Tom
Rohit Banga wrote:
For (1) below, the following works:
http://onpersistence.blogspot.com/2008/04/eclipselink-and-datasources.html
On 2/22/2011 12:14 PM, Rohit Banga wrote:
Thanks James for clarifying.
1. A third party connection pool might work. So now the question is
how to configure a datasource say, UCP, with eclipselink. I have a
J2SE application. Is there any sample code?
2. It seems a Connection Pool has a reference to a owner session so
that explains why an internal connection pool cannot be shared across
server sessions. I tried the following:
// question in comment
DatabaseLogin login1 = new DatabaseLogin();
// set parameters for login1
DatabaseLogin login2 = new DatabaseLogin();
// set parameters for login2
// actually the parameters for login1 and login2 are the same
ConnectionPool connPool1 = new ConnectionPool();
connPool1.setMinNumberOfConnections(10);
connPool1.setMaxNumberOfConnections(20);
connPool1.setLogin(login1);
// create a *serverSession1* for *configuration 1* using
*login1* and *connPool1*
// create a *serverSession2* for *configuration 2* using
*login2* and *connPool1*
// for both serverSessions, serverSession.login() is executed
*
* // ObjectLevelReadQuery with both configurations work, but i
have no way to tell if they are sharing the same connection pool
// if i call logout() on one serverSession, the other is still
accessible and ObjectLevelReadQuery works on this session ... _Why
does it still work?_
// if both serverSessions have the same login object then the
latter configuration persists in both the serverSessions and
// trying to set attributes as per the former configuration
throws an exception
3. Is there a reason for having a reference to the owner session in
the connection pool?
Thanks
Rohit
On 2/16/2011 8:53 PM, James Sutherland wrote:
There is no standard way to share an internal connection pool.
Your best solution is probably to use a third party DataSource, and share
that across your ServerSessions. If you are using an app server, it will
have its own DataSources, otherwise there are many generic data source
implementations such as Oracle DataSource, Oracle UCP, or c3po, etc.
You could also create a single ConnectionPool object and explicitly set it
into each of your ServerSessions. This should work, but note that when you
disconnect one server, it will disconnect the pool.
Rohit Banga-2 wrote:
Hi All
Consider the following usecase.
I have a single database for which multiple table configurations have
been defined. Each different configuration is associated with a
different Server Session. From the server session, I get the entity
manager factory which gives me a JPA Dynamic Helper. So far so good, but
I want to have a single connection pool and share it among different
sessions. If I share the same connection pool object between multiple
server session objects, I get some exceptions because of the conflicting
configuration definition.
What is the standard way of sharing the connection pool across different
sessions?
--
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies
-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
EclipseLink , http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
Blog: http://java-persistence-performance.blogspot.com/ Java Persistence
Performance
--
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies
------------------------------------------------------------------------
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users