How to set application_name for postgres connections?
You could specify the application name in the connection string.
Documentation here.
Example:
jdbc:postgresql://localhost:5435/DBNAME?ApplicationName=MyApp
Take care: the param names are case sensitive.
Use set command:
set application_name to my_application;