1. Sivaprakash BKR
  2. PowerBuilder
  3. Saturday, 8 January 2022 06:15 AM UTC


PB 2019 R3, PostgreSQL 11

While querying the PostgreSQL database, with the following query

SELECT username, application_name, client_hostname
FROM pg_stat_activity
WHERE datname = 'database'
And state = 'active' ;

I get empty in application_name and null in client_hostname.   I want to show correct values for application_name and hostname.  Is there any way to set these values in Powerbuilder so that those values will get displayed when running the above query?

I use the following values to connect to a database from PB

DBParm="ConnectString='Driver=PostgreSQL Unicode;Database=<database>;Server=<serverIP>;Port=<port>;UID=<logid>;PWD=<pass>',DisableBind=1"
Driver=PostgreSQL Unicode

Happiness Always
BKR Sivaprakash


Accepted Answer
mike S Accepted Answer Pending Moderation
  1. Saturday, 8 January 2022 13:59 PM UTC
  2. PowerBuilder
  3. # Permalink

for my connection string i have both APP and CON set to my application name, but i'm not sure if they work and most likely app= does not.  I  haven't looked in a while and not sure if i ever verified it.  my postgresql database is not currently running so i can't really test:

"APP=" + ls_appname + ";"
"CON=" + ls_appname


stack overflow says:

postgresql - Set Applicationname when using Postgres ODBC driver - Stack Overflow


which indicates an execute immediate should work after the connection:

set application_name = ‘<application>’


  1. Sivaprakash BKR
  2. Saturday, 8 January 2022 14:42 PM UTC
set application_name='MYNAME' works.

Thanks, mike S.
  1. Helpful 1
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Saturday, 8 January 2022 12:41 PM UTC
  2. PowerBuilder
  3. # 1


I don't know anything about Postgresql, but it appears that "statistics recollection" can be configured in several ways. Maybe it's simply not set to collect the data you need?



There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.