[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] connecting with different usernames in the same process
|
I guess I actually DO have an issue: there is only one connection
pool, though I have created two different entitymanagers with
different connection properties. The connection pool is associated
with the first set of connection properties.
The functionality I'm trying to implement is creating a new database
user/schema while connected to an existing db/schema/persistenceUnit.
The EntityManagerFactory I'm using is a static. Does the a different
database user imply a new EntityManagerFactory entirely, or is there a
way to specify a named pool when creating a new EntityManager?
thx
On Apr 20, 2009, at 3:02 PM, David Parker wrote:
Never mind. I had an EntityManagerFactory being created earlier in
the process, and wasn't passing the new properties to get
entitymanager2. Not so subtle!
/thx
On Apr 20, 2009, at 1:10 PM, David Parker wrote:
In my application I need to make connections to 2 separate database
usernames. I get the main entitymanager1,then create a second
entitymanager1 with a different username. I need to get a
Connection from the second entitymanager. I am using code like this:
private Accessor getAccessor() {
EntityManagerImpl em = (EntityManagerImpl) entityManager2;
session = em.getServerSession();
Accessor accessor =
session.getDefaultConnectionPool().acquireConnection();
accessor.incrementCallCount(session);
return accessor;
}
The Connection I'm ending up with is for the username from
entitymanager1, where I need a Connection from entitymanager2.
Is this because I am using getDefaultConnectionPool? How should I
handle different database connections in this case?
Thanks.
=============================================
David Parker
dap@xxxxxxxxxxxxxxxxxxxx
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
=============================================
David Parker
dap@xxxxxxxxxxxxxxxxxxxx
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
=============================================
David Parker
dap@xxxxxxxxxxxxxxxxxxxx