You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by 王钦 <wa...@k2data.com.cn> on 2017/02/16 08:48:32 UTC

Could DBCP set different username when getConnection

Hi All:

     I define some roles and grant different privileges in database. And 
I use DBCP to manage the connection. How could I set different user name 
when I get one connection from DBCP?

Thanks for reading this mail.


Qin





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Could DBCP set different username when getConnection

Posted by Bernd <ec...@zusammenkunft.net>.
2017-02-17 15:57 GMT+01:00 Fu, Enzhong <en...@pnc.com>:

> Different user id and roles are for individuals to access database (using
> SQL client or other tools). DBCP is for application, you usually have one
> pool with application id. The application id has all the accesses. You can
> control access of each individual user within the application.
>

Yes but still you can use the requested username as a cache key. This is
part of the JCA architecture and all application server pools support it.
DBCP has for example the PerUserPoolDatasource and SharedPoolDataSource. (I
think there was also somewhere support for proxy users)

Gruss
Bernd

RE: Could DBCP set different username when getConnection

Posted by "Fu, Enzhong" <en...@pnc.com>.
Different user id and roles are for individuals to access database (using SQL client or other tools). DBCP is for application, you usually have one pool with application id. The application id has all the accesses. You can control access of each individual user within the application.

Andrew Fu
Technical Lead
PNC Bank, ALM & Market Risk Technologies
23000 Millcreek Blvd.
Highland Hills, OH 44122
Phone: 216-488-7832
Mail Stop: B7-YB72-04-6


-----Original Message-----
From: 王钦 [mailto:wangqin@k2data.com.cn] 
Sent: Thursday, February 16, 2017 9:06 PM
To: Commons Users List <us...@commons.apache.org>
Subject: Re: Could DBCP set different username when getConnection

Thank you for you suggestion. But it should consume much more system memory...


On 2017年02月16日 17:31, John Patrick wrote:
> >From my understanding of you question. You would need a pool per role/user.
>
> John
>
>
> On 16 February 2017 at 08:48, 王钦 <wa...@k2data.com.cn> wrote:
>> Hi All:
>>
>>      I define some roles and grant different privileges in database. And I
>> use DBCP to manage the connection. How could I set different user name when
>> I get one connection from DBCP?
>>
>> Thanks for reading this mail.
>>
>>
>> Qin
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org




The contents of this email are the property of PNC. If it was not addressed to you, you have no legal right to read it. If you think you received it in error, please notify the sender. Do not forward or copy without permission of the sender. This message may be considered a commercial electronic message under Canadian law or this message may contain an advertisement of a product or service and thus may constitute a commercial electronic mail message under US law. You may unsubscribe at any time from receiving commercial electronic messages from PNC at http://pages.e.pnc.com/globalunsub/
PNC, 249 Fifth Avenue, Pittsburgh, PA 15222; pnc.com



Re: Could DBCP set different username when getConnection

Posted by 王钦 <wa...@k2data.com.cn>.
Thank you for you suggestion. But it should consume much more system 
memory...


On 2017\u5e7402\u670816\u65e5 17:31, John Patrick wrote:
> >From my understanding of you question. You would need a pool per role/user.
>
> John
>
>
> On 16 February 2017 at 08:48, \u738b\u94a6 <wa...@k2data.com.cn> wrote:
>> Hi All:
>>
>>      I define some roles and grant different privileges in database. And I
>> use DBCP to manage the connection. How could I set different user name when
>> I get one connection from DBCP?
>>
>> Thanks for reading this mail.
>>
>>
>> Qin
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Could DBCP set different username when getConnection

Posted by 王钦 <wa...@k2data.com.cn>.
Thank you for your help.


Qin


On 2017\u5e7402\u670817\u65e5 04:14, Phil Steitz wrote:
> On 2/16/17 1:31 AM, John Patrick wrote:
>> >From my understanding of you question. You would need a pool per role/user.
> That is available in PerUserPoolDataSource [1].
>
> Phil
>
> [1] http://commons.apache.org/proper/commons-dbcp/api-2.1.1/index.html
>
> Note to devs:  the 2.2 javadocs seem to be missing from the web site.
>> John
>>
>>
>> On 16 February 2017 at 08:48, \u738b\u94a6 <wa...@k2data.com.cn> wrote:
>>> Hi All:
>>>
>>>      I define some roles and grant different privileges in database. And I
>>> use DBCP to manage the connection. How could I set different user name when
>>> I get one connection from DBCP?
>>>
>>> Thanks for reading this mail.
>>>
>>>
>>> Qin
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: user-help@commons.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Could DBCP set different username when getConnection

Posted by Phil Steitz <ph...@gmail.com>.
On 2/16/17 1:31 AM, John Patrick wrote:
> >From my understanding of you question. You would need a pool per role/user.

That is available in PerUserPoolDataSource [1].

Phil

[1] http://commons.apache.org/proper/commons-dbcp/api-2.1.1/index.html

Note to devs:  the 2.2 javadocs seem to be missing from the web site.
>
> John
>
>
> On 16 February 2017 at 08:48, \u738b\u94a6 <wa...@k2data.com.cn> wrote:
>> Hi All:
>>
>>     I define some roles and grant different privileges in database. And I
>> use DBCP to manage the connection. How could I set different user name when
>> I get one connection from DBCP?
>>
>> Thanks for reading this mail.
>>
>>
>> Qin
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Could DBCP set different username when getConnection

Posted by John Patrick <nh...@gmail.com>.
From my understanding of you question. You would need a pool per role/user.

John


On 16 February 2017 at 08:48, 王钦 <wa...@k2data.com.cn> wrote:
> Hi All:
>
>     I define some roles and grant different privileges in database. And I
> use DBCP to manage the connection. How could I set different user name when
> I get one connection from DBCP?
>
> Thanks for reading this mail.
>
>
> Qin
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org