'Unable to connect to PostgreSQL database from LoadRunner script

I am trying to connect to PostgreSQL database from LR script, but unable to do so.

Please find below the steps performed:-

  1. Downloaded & installed 32 bit PostgreSQL Unicode ODBC driver in a 64 bit Windows machine.

  2. Created a System DSN with name ( PostgreSQL32W).

  3. Tested the connection, all good.

  4. From the LR script, made use of lr_db_connect function:-

    lr_db_connect("StepName=PostgreSQL32W",
     "ConnectionName=PostgreSQL32W",
     "ConnectionString=Driver={PostgreSQL Unicode};Server=X.Y.Z.W;Database=***;Trusted_Connection=False;User=****;Password=****",
     "ConnectionType=ODBC",
     LAST);
    

After executing the block of code, i am getting the below error:-

Action.c(81): DB Connection failed {"ERROR [08001] FATAL: password authentication failed for user "Sohit Kanwar""}

The issue is, no where i am using "Sohit Kanwar", as the username. This is the my logged in windows username & not the username i have used in LR connection string.

Any help in this regards will be useful.

Thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source