PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → HFSQL Reconnection
HFSQL Reconnection
Débuté par Gabriel Marten, 01 sep. 2014 18:56 - 4 réponses
Posté le 01 septembre 2014 - 18:56
Hi

I am having problems when the connection to a remote HFSQL (internet) is lost.

the resulting error is:

Proyecto : TF-RB-BI
Component : WDGPU

WL llamada:
Proceso 'Global Procedure GPU_nGetUserID' (COL_GPU.GPU_nGetUserID), línea 14, hilo 0
función 'HReadSeekFirst', sintaxis 0

¿Qué ha ocurrido?
La comunicación con el servidor ha fallado.

Código de error: 74000
Nivel: error fatal (EL_FATAL)
WD55 Código de error: 4000

Código de error del sistema: 10053
mensaje de error del sistema:
An established connection was aborted by the software in your host machine.

Dump del error de 'WD190HF.DLL' del módulo (19.0.102.2).
Identificador de información detallada (err.): 73203
Información de depuración:
GetHeader
Fonction (7,12)
Información adicional:
EIT_SERVEURCS :
EIT_LOGICALTABLENAME :
EIT_PILEWL :
Global Procedure GPU_nGetUserID (COL_GPU.GPU_nGetUserID), línea 14
Global Procedure GPU_nGetUserID (COL_GPU.GPU_nGetUserID), línea 14
Global Procedure GPU_nGetUserID (COL_GPU.GPU_nGetUserID), línea 14
Initializing TF-RB-BI (), línea 298
EIT_COMPOSANT :
WDGPU
EIT_DATEHEURE : 27/08/2014 17:33:11

I have read that the reconnection should be automatic but what I get is a fatal error from windev with no reconnect option wich ends the execution.

I added this code to project :

HOnError("*",hErrConnectionLoss,Reconnection)

but when debugging the application the HError() function returns a 0

Is the reconnection automatic ?
Should I modify certain options in the project ?

Thanks for your help!
Posté le 02 septembre 2014 - 15:03
Hi Gabriel,

We have experienced some cases where the automatic reconnection is not done. Maybe this is one of these case? I would send the technical details for the Free Support.

The case we have is the following: if a laptop has both wired (RJ45) network and WiFi network, the default IP address used by the laptop if the wired one. If you unplug the laptop from the wired network it automatically switch to WiFi network and the IP address of the laptop changes. THen the automatic reconnection of HFSQL does not work. It might work for others (?) but for us this is a typical case it will crash.

Best regards,
Alexandre Leclerc
Posté le 02 septembre 2014 - 15:28
Hi,

I'll be sharing a MyApplication class and an OO WX framework soon... Here is an excerpt of that class having a working solution on doing auto reconnects from your WD applications:

In the project Init Code:
GLOBAL MyApp is MyApplication //Manage Database Connection Loss HOnError("*",hErrPerteConnexion,MyApplication::DatabaseReconnect)
Next the MyApplication class has a global method DatabaseReconnect() that manages the reconnection.
This is the code:
FUNCTION GLOBAL DatabaseReconnect() //Set flag ::DB_ReconnectionRunning = True ::DB_ReconnectionNrOfTrials = 1 //Reconnect ToastAffiche("Database connection lost."+CR+"Recovering connection: "+StringBuild("Trial %1 van %2",::DB_ReconnectionNrOfTrials,::DB_ReconnectionMaxNrOfTrials),toastLong,cvMilieu,chCentre) MultitaskRedraw() IF HReconnect() THEN ToastSupprimeTout() ::DB_ReconnectionRunning = False RESULT opRetry ELSE ToastSupprimeTout() ::DB_ReconnectionNrOfTrials++ // We retry the operation WHILE ::DB_ReconnectionNrOfTrials <= ::DB_ReconnectionMaxNrOfTrials ToastAffiche("Database connection lost."+CR+"Recovering connection: "+StringBuild("Trial %1 van %2",::DB_ReconnectionNrOfTrials,::DB_ReconnectionMaxNrOfTrials),toastLong,cvMilieu,chCentre) MultitaskRedraw() // Non-recoverable errors // 75100 : transaction en cours // 75101 : requête/vue en cours de remplissage // 75102 : blocage d'un fichier entier // 75103 : blocage en lecture et écriture // 75104 : l'enregistrement bloqué en écriture a changé pendant la déconnexion // 75105 : reconnexion non supporté par le serveur IF HError(hErrCurrent) _IN_ ( 75100, 75101, 75102, 75103, 75104, 75105 ) ToastSupprimeTout() // Non recoverable //1 : Close application //2 : Restart application SWITCH Dialog("The application cannot recover the database connection and needs to shut down.", "HFCS Error nr. "+HError(hErrCurrent)) // De toepassing afsluiten CASE 1 ::DB_ReconnectionRunning = False RESULT opEndProgram // De toepassing opnieuw opstarten CASE 2 ::DB_ReconnectionRunning = False RESULT opRelaunchProgram END ELSE //Increment trials ::DB_ReconnectionNrOfTrials++ IF HReconnect() THEN ToastSupprimeTout() ::DB_ReconnectionRunning = False RESULT opRetry END END END END //Max trials reached IF ::DB_ReconnectionNrOfTrials >= ::DB_ReconnectionMaxNrOfTrials THEN ToastSupprimeTout() //1 : Close application //2 : Restart application SWITCH Dialog("The application cannot recover the database connection and needs to shut down.", "The maximum number of reconnection trials has been reached.") // De toepassing afsluiten CASE 1 ::DB_ReconnectionRunning = False RESULT opEndProgram // De toepassing opnieuw opstarten CASE 2 ::DB_ReconnectionRunning = False RESULT opRelaunchProgram END ELSE ::DB_ReconnectionRunning = False RESULT opRetry END
Never had any issues with this piece of code for years already on WD applications that connect to an internet based HFCS.

Cheers,

Peter H.
Posté le 02 septembre 2014 - 17:04
Hi Alexandre

Thank you for your help!
Posté le 02 septembre 2014 - 17:08
Hi Peter

Thank's for your help!

Gabriel Marten