- Paul Murray
- PowerBuilder
- Saturday, 26 August 2017 01:37 PM UTC
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)
: (
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
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.