Обсуждение: How to identify connected Users?

Поиск
Список
Период
Сортировка

How to identify connected Users?

От
Jens Hartwig
Дата:
Hello all,

is there any way to identify users which are currently connected to the
database? Does perhaps even exist a method to notify this users (e.g. to
close the connection)?

Thanks in advance and best regards,

Jens

=============================================
Jens Hartwig
---------------------------------------------
debis Systemhaus GEI mbH
10875 Berlin
Tel.     : +49 (0)30 2554-3282
Fax      : +49 (0)30 2554-3187
Mobil    : +49 (0)170 167-2648
E-Mail   : jhartwig@debis.com
=============================================

Re: How to identify connected Users?

От
Michel Decima
Дата:
>is there any way to identify users which are currently connected to the
>database? Does perhaps even exist a method to notify this users (e.g. to
>close the connection)?

 I don't know if this feature exists, but it will be very useful
 for me, too...

Re: How to identify connected Users?

От
Peter Eisentraut
Дата:
Jens Hartwig writes:

> is there any way to identify users which are currently connected to the
> database? Does perhaps even exist a method to notify this users (e.g. to
> close the connection)?

ps ax | grep postgres

is the best way to go.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


Re: How to identify connected Users?

От
Michel Decima
Дата:
>Jens Hartwig writes:
>
>> is there any way to identify users which are currently connected to the
>> database? Does perhaps even exist a method to notify this users (e.g. to
>> close the connection)?
>
>ps ax | grep postgres
>
>is the best way to go.

 This command tells me that several backends are running, and owned by
 the postgres user... (all my users are connected via the LAN to the
 database server).




Re: How to identify connected Users?

От
Dmitry Morozovsky
Дата:
On Fri, 1 Dec 2000, Peter Eisentraut wrote:

PE> > is there any way to identify users which are currently connected to the
PE> > database? Does perhaps even exist a method to notify this users (e.g. to
PE> > close the connection)?
PE>
PE> ps ax | grep postgres
PE>
PE> is the best way to go.

Nope. Using this you can identify UNIX users, instead of PG users. And, if
the scripts are running from the web server, there will be only
nobosy/httpd in most cases...

Sincerely,
D.Marck                                   [DM5020, DM268-RIPE, DM3-RIPN]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru ***
------------------------------------------------------------------------


Re: How to identify connected Users?

От
Peter Eisentraut
Дата:
Dmitry Morozovsky writes:

> PE> ps ax | grep postgres
> PE>
> PE> is the best way to go.
>
> Nope. Using this you can identify UNIX users, instead of PG users.

Wrong.

$ ps ax | grep postgres
 1236 pts/1    S      0:00 psql template1 -U postgres
 1237 pts/1    S      0:00 /usr/bin/postgres localhost postgres template1 idle

> And, if the scripts are running from the web server, there will be
> only nobosy/httpd in most cases...

The question was how to find out what users are connected to the database
-- there's your answer.  Or do you suggest figuring out the identity of
the person that connected to your web page?

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


Re[2]: How to identify connected Users?

От
Bruno Dickhoff
Дата:
Hello Dmitry,

Saturday, December 02, 2000, 3:15:51 PM, you wrote:

DM> On Fri, 1 Dec 2000, Peter Eisentraut wrote:

PE>> > is there any way to identify users which are currently connected to the
PE>> > database? Does perhaps even exist a method to notify this users (e.g. to
PE>> > close the connection)?
PE>>
PE>> ps ax | grep postgres
PE>>
PE>> is the best way to go.

DM> Nope. Using this you can identify UNIX users, instead of PG users. And, if
DM> the scripts are running from the web server, there will be only
DM> nobosy/httpd in most cases...

Well,  you  have  to  divide  into users of the database (which is indeed your
webserver  or  the  user  specified  in  the  jdbc  url) and the users of your
webpage.

When  a user opens a webpage, the webserver itself (or the servlet, jsp, php -
whatever) opens the db connection and delivers the output back to the user. So
the  user  of the db in that moment is your webserver, jsp, servlet... and not
the user who is calling your webpage. The "user" that is connecting to your db
is normally a generic user.

In short: The user of your webpage and the db-user are normally not the same.

--
Best regards,
 Bruno                            mailto:bruno@dickhoff.de