1. Konstantin Goldobin
  2. PowerBuilder
  3. Thursday, 15 November 2018 12:38 PM

Hello,

Trying to check if a transaction object is connected to a database, I'm calling its DBHandle() function. When the objects is not connected, this call yields the transaction object DBError event. How can this be worked around?

PB 12.5.1 b 4595, DBMS=O10

Best regards,
Konstantin

Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 15 November 2018 13:57 PM
  2. PowerBuilder
  3. # 1
0
Votes
Undo

The DBHandle is not a reliable method to verify the database connection. If your app connects to the database and then the connection is lost, the handle is not reset.

What you need to do is run a very simple query. For example, you can do a select count from a table that you know has less than 10 rows.

Comment
Hi Konstantin ... FWIW, just issue the Disconnect and do not bother checking the DB Status. If the Disconnect works, the connection is gone. If the Disconnect fails, the connection is gone. So either way, you don't need to check the result of the DB request (IMHO).
  1. Chris Pollach @Appeon
  2. Thursday, 15 November 2018 14:42 PM
He is using Oracle which triggers a DBError event on the transaction object automatically. He isn't checking the result in the Close event.
  1. Roland Smith
  2. Thursday, 15 November 2018 15:31 PM
Yes, so your Boolean instance variable suggestion would be the way to proceed then. If the variable is TRUE in the DBError event - do nothing.
  1. Chris Pollach @Appeon
  2. Thursday, 15 November 2018 15:53 PM
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.