Re: Application name patch - v2

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Magnus Hagander" <magnus(at)hagander(dot)net>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Heikki Linnakangas" <heikki(dot)linnakangas(at)enterprisedb(dot)com>, "Harald Armin Massa" <chef(at)ghum(dot)de>, "Dave Page" <dpage(at)pgadmin(dot)org>, "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Application name patch - v2
Date: 2009-10-20 22:09:31
Message-ID: 4ADDEECB020000250002BC0A@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-10-20 22:18:50 Re: Going, going, GUCs!
Previous Message Tom Lane 2009-10-20 22:06:48 Re: alpha2 release notes