Eclipselink without connection pool [message #390589] |
Fri, 24 July 2009 02:48  |
Eclipse User |
|
|
|
Hi all
I have the following scenario. I have a website where multiple users
connect to a database using EL. I need every user that logs in to the
website to have his own connection to the database (the users that log
in each have a database account, too). So I don't need to use connection
pooling at all. What I need is that every user gets an entitymanager
that has its own exclusive connection to the database. How an I set this
up with EL?
|
|
|
|
|
|
|
Re: Eclipselink without connection pool [message #405802 is a reply to message #390608] |
Thu, 30 July 2009 02:18   |
Eclipse User |
|
|
|
Thanks, that worked, I solved the OSGi Problem, too, I must have messed
up something.
But now there is the next strange problem comming along, so I hope I may
bother you again with that.
I now want to give the database user a certain role by setting it after
the creation of the entitymanager like this.
em.getTransaction.begin();
em.createNativeQuery(BEGIN DBMS_SESSION.SET_ROLE('userrole' IDENTIFIED
BY somepassword); END;).executeUpdate();
em.getTransaction.commit();
As there is always an exclusive connection used, I assumed this should
work. The odd thing is that it does in all following transactions that
are ended with commit();
The first transaction that is ended with a call to rollback(), causes
that the role is lost. At that time the entitymanager cannot see any of
the tables anymore to which the role grants access.
Why is that only happening when I do rollback, and not on commit?
Am I missing something?
James schrieb:
> Set the min to 0, not the max.
>
> There is both a read and write pool (in 2.0 you can configure a single
> pool).
>
> "eclipselink.jdbc.read-connections.min"="0"
> "eclipselink.jdbc.write-connections.min"="0"
>
> In code you need to set the default and read connection pools min.
>
> Not sure on the OSGI issue, perhaps someone else knowledgeable on OSGI
> can answer this.
>
>
|
|
|
Re: Eclipselink without connection pool [message #413741 is a reply to message #405802] |
Thu, 30 July 2009 05:30  |
Eclipse User |
|
|
|
Some more infromation:
I just figured out that setting the role after a rollback again doesnt
help, somehow the role is not associated with the user again, although
setting the role does not cause an error.
Thomas Haskes schrieb:
> Thanks, that worked, I solved the OSGi Problem, too, I must have messed
> up something.
>
> But now there is the next strange problem comming along, so I hope I may
> bother you again with that.
>
> I now want to give the database user a certain role by setting it after
> the creation of the entitymanager like this.
>
> em.getTransaction.begin();
> em.createNativeQuery(BEGIN DBMS_SESSION.SET_ROLE('userrole' IDENTIFIED
> BY somepassword); END;).executeUpdate();
> em.getTransaction.commit();
>
> As there is always an exclusive connection used, I assumed this should
> work. The odd thing is that it does in all following transactions that
> are ended with commit();
>
> The first transaction that is ended with a call to rollback(), causes
> that the role is lost. At that time the entitymanager cannot see any of
> the tables anymore to which the role grants access.
>
> Why is that only happening when I do rollback, and not on commit?
>
> Am I missing something?
>
> James schrieb:
>> Set the min to 0, not the max.
>>
>> There is both a read and write pool (in 2.0 you can configure a single
>> pool).
>>
>> "eclipselink.jdbc.read-connections.min"="0"
>> "eclipselink.jdbc.write-connections.min"="0"
>>
>> In code you need to set the default and read connection pools min.
>>
>> Not sure on the OSGI issue, perhaps someone else knowledgeable on OSGI
>> can answer this.
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.04494 seconds