Could DBCP set different username when getConnection

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Could DBCP set different username when getConnection

John Patrick
From my understanding of you question. You would need a pool per role/user.

John


On 16 February 2017 at 08:48, 王钦 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Could DBCP set different username when getConnection

Phil Steitz
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, 王钦 <[hidden email]> 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Could DBCP set different username when getConnection

王钦
In reply to this post by John Patrick
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, 王钦 <[hidden email]> 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Could DBCP set different username when getConnection

王钦
In reply to this post by Phil Steitz
Thank you for your help.


Qin


On 2017年02月17日 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, 王钦 <[hidden email]> 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: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Could DBCP set different username when getConnection

enzhong.fu
In reply to this post by 王钦
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:[hidden email]]
Sent: Thursday, February 16, 2017 9:06 PM
To: Commons Users List <[hidden email]>
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, 王钦 <[hidden email]> 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Could DBCP set different username when getConnection

Bernd Eckenfels
2017-02-17 15:57 GMT+01:00 Fu, Enzhong <[hidden email]>:

> 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
Loading...