1. Paweł Kasperek
  2. PowerBuilder
  3. Wednesday, 22 February 2023 10:45 AM UTC

Hi,

 

I have got a problem with the connection to the remote database server. I used Postgres database via ODBC. How can I set connection timeout in PB transaction or connection configuration? I would change the connection timeout parameter from the application, not in ODBC DNS.

Regards,

Pawel

 

Accepted Answer
Paweł Kasperek Accepted Answer Pending Moderation
  1. Thursday, 29 February 2024 16:07 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi,

 

Currently, I don't resolve my problem with connection timeout when I use ODBC PostgreSQL driver. But I migrated to ADO.NET Postgresql provider and the problem is resolved.

Comment
  1. Armeen Mazda @Appeon
  2. Wednesday, 16 October 2024 21:40 PM UTC
Thanks for sharing the solution. Yes, the ADO.NET driver is the recommended driver now to use for PostgreSQL.
  1. Helpful 1
There are no comments made yet.
Larry McClain Accepted Answer Pending Moderation
  1. Wednesday, 16 October 2024 20:41 PM UTC
  2. PowerBuilder
  3. # 1

SQLCA.DBMS = "ODBC"
SQLCA.Database = ddlb_database.Text
SQLCA.UserID = sle_userid.Text
SQLCA.DBPass = Trim( sle_password.Text )
SQLCA.DBParm = "DisableBind=1,AutoCommit=0," + "ConnectString='DSN=" + SQLCA.Database + ";UID=" + SQLCA.UserID + ";PWD=" + SQLCA.DBPass + "',ConnectOption='SQL_DRIVER_CONNECT,SQL_DRIVER_NOPROMPT;LoginTimeOut=0'"

 

Comment
There are no comments made yet.
Peter Pang @Appeon Accepted Answer Pending Moderation
  1. Thursday, 23 February 2023 05:29 AM UTC
  2. PowerBuilder
  3. # 2

Hi Pawel,

 

You can try this:

  1. Tick the Ignore Timeout checkbox at PostgreSQL ODBC的Options - > Datasource (Page1) -> Ignore Timeout (Attachment #1).
  2. Then set the Timeout value at PB Database Profile Setup->Network->Login Timeout (Attachment #2).

When I set LoginTimeOut=1 here, it will prompt timeout expired and the message is gone when I set LoginTimeOut=10, which means LoginTimeOut is effective when it connects.

 

SQLCA.DBParm = "ConnectString='DSN=PostgreSQL35W;UID=postgres;PWD=<******>',LoginTimeOut=99"

 

Best Regards,

Peter

Attachments (2)
Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Wednesday, 22 February 2023 23:35 PM UTC
  2. PowerBuilder
  3. # 3

I'm not sure what you seek is possible. The DNS >>> IS <<< the designated means of connecting to the database, and the paramemters for the connections are specified in that DNS.

If you want to change connection parameters at runtime I suggest you 1) create a new DNS synamically OR have a separate DNS available (i.e. already created but not in use), 2) close the existing connections, and 3) reconnect with the new DNS.


If you wish, you can connect to the database without a DNS at runtime. Here's an example of such a connection that you would use with SQLCA (or whatever transaction object you choode):
     DBPARM = ConnectString='DSN=PostgreSQL35W;UID=cabdevusr;PWD=cabdevusr',DelimitIdentifier='No',LoginTimeOut=99",DisableBind=1

 

 

Comment
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.