GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEV
,
WEBDEV
e
WINDEV Mobile
Inicio
|
Mensagens recentes
|
Conecte-se...
|
Disconnect
|
Português
Inicio
→
WINDEV 2024
→
MySQL Server Has Gone Away
MySQL Server Has Gone Away
Iniciado por André Labuschagné, abr., 15 2018 1:05 PM - 3 respostas
Conecte-se…
André Labuschagné
#1
Publicado em abril, 15 2018 - 1:05 PM
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é
Denunciar
0
0
André Labuschagné
#2
Publicado em abril, 15 2018 - 4:09 PM
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é
Denunciar
0
0
Stefano Giavardi
#3
Publicado em abril, 15 2018 - 11:07 PM
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.
Denunciar
0
0
André Labuschagné
#4
Publicado em abril, 24 2018 - 6:50 AM
Hi Stefano
Nice solution. Thanks.
Cheers
André
Denunciar
0
0
→ Voltar para WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versões anteriores)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Tipo de Pesquisa
Apenas tópicos
Todas as mensagens
Período de pesquisa
Qualquer momento
Última hora
Últimas 24 horas
Semana passada
Mês passado
Ano passado
Cancelar
Pré-visualização da sua mensagem
Adicionar imagem
Importar uma imagem de uma URL
Enviar uma imagem a partir do seu disco
Deixe um ficheiro ou clique em "Procurar ..."
ou
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto