Re: Application name patch - v2

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: Application name patch - v2
Дата
Msg-id 4ADDEECB020000250002BC0A@gw.wicourts.gov
обсуждение исходный текст
Ответ на Re: Application name patch - v2  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: Application name patch - v2  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Magnus Hagander <magnus@hagander.net> wrote:
> For java, it doesn't even go through libpq, so it wouldn't be set
> for it. And I'd expect the JDBC driver to set it based on Something
> Reasonable (TM) that it can get the information about. After all,
> this thing was listed in the JDBC spec somebody said...
I can't see a good way to get a meaningful default from within the
bowels of the JDBC driver, unless it's taking a system property or
environment variable.  First off, generating a stack trace to try to
pick up a class name would be too expensive to be something you'd want
to do by default when opening a connection.  For another, many
applications are started from a bootstrap class (for good reason), so
you can't just take the initial class name for a meaningful default. 
If you were running a GUI application you might try to find the title
of some window frame, but that's pretty ugly.
In short, I'd suggest supporting a system property for a default name.
(For those unfamiliar with Java, a system property is very much like
an environment variable, but just for the one Java Virtual Machine.) 
That seems more sane than an environment variable for the Java world.
I don't see much other reasonable alternative, except of course that
you should be able to override it when setting up any individual
connection.
-Kevin


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: alpha2 release notes
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Going, going, GUCs!