1. Muhammad Asim Butt
  2. PowerBuilder
  3. Monday, 29 January 2018 17:03 PM UTC

Hi,

In case the database connection drops, does PowerBuilder 17 provide a way to reconnect database connection without having to reset datawindows?

I have been using Powerbuilder 12.6,  when the database connection drops, unless I "Disconnect;" and then Connect the database again and bind datawindows with new connection, the datawindows will not work.

 

Regards,

Muhammad Asim

 

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 30 January 2018 15:07 PM UTC
  2. PowerBuilder
  3. # 1

I should also mention that the other approach is to design your App so that it does not allow the DB connection to time out. This is one of the leading causes of App to DB disconnection. You can evade this situation by using a Timer that pings the DBMS every few minutes with something simple like a "SELECT 1" SQL command. Just enough to make the DBMS think that your session has not expired from non activity.

HTH ... Chris

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 29 January 2018 17:26 PM UTC
  2. PowerBuilder
  3. # 2

Hi Muhammad;

  You can use the newer Transaction Object event "DBError" and the newer function DBHandle() to trap the DB Connection error. After a clean Re-Connect though, you'll need to re-issue a SetTransObject() again on each DWO. My suggestion would be to set a global flag on a reconnect and if the global flag is true, handle the SetTransObject() method calls on the next RetrieveStart and UpdateStart DW Control an DataStore object's events.

HTH

Regards .. .Chris

Comment
  1. Roland Smith
  2. Monday, 29 January 2018 19:15 PM UTC
The DBHandle is not reset when your connection is lost. The best way to validate the connection is to run a minor SQL statement, like SELECT getdate() INTO :ldt_current from AnyTable; (and AnyTable is a table with a small number of rows).

  1. Helpful
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.