PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 2024 → [WD8] Robust Database Connection
[WD8] Robust Database Connection
Iniciado por Raimund Schuldhaus, mar., 30 2004 6:15 PM - Sem resposta
Publicado em março, 30 2004 - 6:15 PM
Hi all,
I did make a test app to test the robustness of the database connection in WinDev 8. I did use the code below. A timer run the procedure below every 5 seconds. The analyze behind this app has a OLEDB connection to MS SQL Server. With a second app I stopped the SQL Server every 15 minutes for 5 minutes and start it then again. The test app did run two days WITHOUT any problem.
PROCEDURE MyTimer()
bOK is boolean
bConnected is boolean = True
nAttempt++

WHEN EXCEPTION IN
bOK = HReadFirst(MsgIn, InID)

IF bOK
Static2..Value = MsgIn.Msg
ELSE
Static2..Value = ""
END
Static1..Value = "Connection #" + nAttempt
Static1..Color = iLightBlue
IF bOK THEN
HDelete(MsgIn)
END
DO
bConnected = False
END


IF NOT bConnected THEN
Static1..Value = "No Connection #" + nAttempt
Static1..Color = iLightRed
Static2..Value = ""
objMain:CloseConn()
bOK = objMain:OpenConn()
END