FOROS PROFESIONALES
WINDEV
,
WEBDEV
y
WINDEV Mobile
Inicio
|
Mensajes recientes
|
Conéctese...
|
Desconectar
|
Español
Inicio
→
WINDEV 2024
→
MySQL Server Has Gone Away
MySQL Server Has Gone Away
Iniciado por André Labuschagné, 15,abr. 2018 13:05 - 3 respuestas
Conéctese…
André Labuschagné
#1
Publicado el 15,abril 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é
Informar
0
0
André Labuschagné
#2
Publicado el 15,abril 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é
Informar
0
0
Stefano Giavardi
#3
Publicado el 15,abril 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.
Informar
0
0
André Labuschagné
#4
Publicado el 24,abril 2018 - 06:50
Hi Stefano
Nice solution. Thanks.
Cheers
André
Informar
0
0
→ Volver a WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versiones precedentes)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Búsqueda Tipo
Sólo temas
Todos los mensajes
Periodo Buscar
Cualquier fecha
Última hora
Última 24 horas
Última semana
Último mes
Último año
Cancelar
Vista previa del mensaje
Añadiendo una imagen
Importar una imagen desde una URL
Enviar una imagen desde un archivo de su disco
Arrastrar un archivo o click en "Examinar..."
o
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto