Greetings All,
I have a PowerBuilder 12.5 application with code in a timer event that periodically looks for records to process. While not a PowerBuilder issue, we have been having some trouble with a database where the connection times out or sometime you just cannot connect on the first go try (or the second). Other people are working on ferreting out the issue with the database.
In the meantime, I need a way to reliably check that the database is connected and reconnect if necessary.
In the code in the timer event, I have the following:
timer(0)
of_connect()
long connected
connected = dw_1.settransobject(sqlca)
if connected <> 1 then
of_disconnect()
of_connect()
dw_1.settransobject(sqlca)
end if
dw_2.settransobject(sqlca)
…processing…
of_disconnect()
timer(15)
Nevertheless, when I check on the application after a few hours, I see the following error in a popup window that causes the application to halt until human intervention comes along (like me restarting the application). >: (
I would really appreciate it if someone can kindly suggest a way to code to continually retry the connection as it seems sporadic while suppressing the exception window.
Thanks All!! Paul
MESSAGEBOX EXCEPTION:
Connection failed:
SQLState '01000'
SQL Server Error: 10060
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (PreLoginHandshare()).
Connection failed:
SQLState: 08001
SQL Server Error: 11
[Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation.
'OK' button