FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
MySQL Server Has Gone Away
MySQL Server Has Gone Away
Débuté par André Labuschagné, 15 avr. 2018 13:05 - 3 réponses
Connectez-vous…
André Labuschagné
#1
Posté le 15 avril 2018 - 13:05
Hi All
I eventually found out why the timer procedure is bombing out. After not writing to MyTable for a length of time, in other words, it is idle on the MySQL side so I suspect the channel is being closed, I get the error below:
//native MySQL access error.
//Unable to open or read <MyTable> file.
//Error Number = 22
//The following error was returned by the <123.123.123.123> database:
//Error number = <2006>.
//Error message:
//MySQL server has gone away - Failed To Reset MyTable
This happens on an HReset(MyTable)
I am confused as HOpenConnection returns true. I am going to try and open the connection in this procedure if any writing is to be done or ignore it. And close it when leaving the procedure if it was opened.
Any other ideas?
Cheers
André
Signaler
0
0
André Labuschagné
#2
Posté le 15 avril 2018 - 16:09
Hi All
Update so far.
It appears that the target Db was disconnecting and WX was not connecting again when the next bunch of writes came around. HOpenConnection on its own did not help at all. What has seemed to have helped is the following:
1. Do NOT handle opening connections and assigning tables to the connection on launching the app.
2. Only open the connection and assign the table to the connection when the procedure is called.
3. Explicitly close the connection when exiting the procedure.
This seems to have worked. Not sure what is going on in the black box at this stage but this seems top be working. I am guessing that not closing the connection was the problem all along.
NOTE: The db we are connecting to is not ours - we have no control over the settings there other than the credentials to connect, read and write.
Cheers
André
Signaler
0
0
Stefano Giavardi
#3
Posté le 15 avril 2018 - 23:07
We experienced the same issue.
Our solution is 1 hopenconnection when starting the application and no hcloseconnection.
We keep 1 connection alive for each app user even if the program stay opened for days.
The trick is launching a "keep alive" to mysql every 10 minutes. For us the "keep alive" is nothing more than a simple query "SELECT NOW()" called by hexecutesqlquery.
It works always, no more lost connection issues.
We use several external compoenents called from the main exe and all share the same db context. Even if i change app module (= open another component) and even if the app uses 10 mysql databases jumping from one to another every second... the mysql connection ID is always the same until the user closes the program.
The second connection per user is only the one we need to open on local HF db to continue working in case central mysql is not available for some reason.
Signaler
0
0
André Labuschagné
#4
Posté le 24 avril 2018 - 06:50
Hi Stefano
Nice solution. Thanks.
Cheers
André
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte