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
Set the “application name” under Server Status
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
By default, this query is not executed by our provider because of the performance considerations.
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();