Skip to Content
0
Former Member
Sep 15, 2014 at 09:08 PM

How to auto reconnect to database after network disconnect?

720 Views

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 **

dw_abc.Retrieve()

uo_transaction - SqlPreview()

uo_transaction - SqlPreview()

** General Network Error messagebox pops up **

uo_transaction - DBError() {

if code = 11 then

do

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

if this.SQLCode < 0 then

sleep(10)

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?

Resources:

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

Database Connection - Google Groups

DBError - SyBooks Online