Page 1 of 1

Set the “application name” under Server Status

Posted: Thu 21 Oct 2010 17:28
by ccampbell
Hi, using devart.data.PostgresSql 5.0.10.0

When I create a connection to a Postgres database, that connection appears under "server status" of the pgAdmin III program. However, the “application name” column of my connection is blank. I see that the active connections that appear for the pgAdmin program show that their application name is pgAdmin which is correct.

My question is how do I set the "application name" so it will appear in the column under active connections? I need to see what application “owns” the given active data connection. I’m guessing it’s when I create the data connection object somewhere but I can’t figure out which property to set.

Thanks for your help

Posted: Mon 25 Oct 2010 15:11
by Shalex
Thank you for your report. This feature ("Application name") was implemented in pgAdmin 1.12. I will post here when we add support for it in dotConnect for PostgreSQL.

Posted: Wed 01 Dec 2010 17:17
by Shalex
This is a designed behaviour. It is necessary to perform an additional query to database on the current connection to set Application name:
set application_name = '{0}'
{0} - application name

Code: Select all

    PgSqlConnection conn = new PgSqlConnection();
    conn.ConnectionString = "server=localhost;port=5433;uid=postgres;pwd=postgres;database=postgres;";
    conn.Open();
    //Application name is not set
    PgSqlCommand cmd = conn.CreateCommand();
    cmd.CommandText = "set application_name = 'myApp'";
    cmd.ExecuteNonQuery();
    //Application name is set to 'myApp'
    conn.Close();
By default, this query is not executed by our provider because of the performance considerations.