Set the “application name” under Server Status

Set the “application name” under Server Status

Postby ccampbell » Thu 21 Oct 2010 17:28

Hi, using

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
Posts: 29
Joined: Tue 01 Jun 2010 17:31
Location: Oregon

Postby Shalex » Mon 25 Oct 2010 15:11

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.
Devart Team
Posts: 7884
Joined: Thu 14 Aug 2008 12:44

Postby Shalex » Wed 01 Dec 2010 17:17

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;";
    //Application name is not set
    PgSqlCommand cmd = conn.CreateCommand();
    cmd.CommandText = "set application_name = 'myApp'";
    //Application name is set to 'myApp'

By default, this query is not executed by our provider because of the performance considerations.
Devart Team
Posts: 7884
Joined: Thu 14 Aug 2008 12:44

Return to dotConnect for PostgreSQL