Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to auto reconnect to database after network disconnect?

Hey guys I am fairly new to Powerbuilder, I am trying to add database reconnect functionality to a application, but the application always fatal crashes after returning from the DBError event.

Flow of Events from Debugger:

** Get to breakpoint on Retrieve() statement **

** Manually disconnect network connection **


uo_transaction - SqlPreview()

uo_transaction - SqlPreview()

** General Network Error messagebox pops up **

uo_transaction - DBError() {

if code = 11 then


    this.test_sql() // function that runs simple SQL to test database connection

    if this.SQLCode < 0 then


      DISCONNECT using this;

      CONNECT using this;

    end if

  loop while this.SQLCode < 0

end if

return code


** Manually reconnect network connection, DBError returns **

uo_transaction - SqlPreview()

** Application fatally crashes - "Sybase Powerbuilder 12.5 has stopped working"**

Any help or suggestions?


Handling Connection Time Out

SQL Error Handler

How can I tell if I need to do a of_SetTransObject after database disconnect? - Google Groups

Database Connection - Google Groups

DBError - SyBooks Online

Former Member
Former Member replied

Yes, "B" would be my recommendation for a complex application with lots of active DS/DC's. Just trap the DB connectivity error and then put out a humane message to the application user that we need to restart due a system error.  

1 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question