1. Muhammad Asim Butt
  2. PowerBuilder
  3. Monday, 29 January 2018

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 Accepted Answer Pending Moderation
0
Votes
Undo

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.
  1. Tuesday, 30 January 2018
  2. PowerBuilder
  3. # 1
Chris Pollach Accepted Answer Pending Moderation
0
Votes
Undo

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
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. Roland Smith
  2. Monday, 29 January 2018
There are no comments made yet.
  1. Monday, 29 January 2018
  2. PowerBuilder
  3. # 2
  • Page :
  • 1


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