Reputation: 1260
How can I set the application name when connection to Postgres with the psqLODBC driver?
You get the application name from pg_stat_activity.application_name.
I tried different Parameters in the connection string.
APP=...;
application_name=...;
APP_NAME=...
in all different variations.
Nothings works and pg_stat_activity.application_name always returns an empty string.
Upvotes: 0
Views: 1455
Reputation:
Once you have established a connection in your application, you can run a SQL statement to change the application_name dynamically.
set application_name = 'doev';
You run that just like any other statement (that does not return a result) with your programming language. But remember if you have turned off autocommit in your connection, you need to commit
that SET
statement. If you are running in autocommit mode, that is not necessary.
Upvotes: 3