Lost connection to MySQL server during query

Lost connection to MySQL server during query

Postby vilian » Fri Jul 28, 2023 8:25 pm

Hi Guys,
Sometimes, my customer is getting an error with the message "Lost connection to MySQL server during query". Nowaday, i already have an implementation to surround this problem, so i would like this message was not showed. Is it possible ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 972
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Lost connection to MySQL server during query

Postby nageswaragunupudi » Fri Jul 28, 2023 10:20 pm

Nowaday, i already have an implementation to surround this problem,

What is your implementation please?

This message is displayed if and when the connection with the server is lost when the application is trying to access the server.
This mostly happens due to physical disconnection of cables or loss of internet in case of cloud servers, etc.
This message is intended to advise the user to restore the physical connection and try the operation again. We considered this important instead of just keeping the application hanging and keeping the user in suspense.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Lost connection to MySQL server during query

Postby csincuir » Sat Jul 29, 2023 5:46 pm

Hi Vilian
You can check if the "my.cnf" file has this line:
wait_timeout=28800

Best regards

Carlos
csincuir
 
Posts: 407
Joined: Sat Feb 03, 2007 6:36 am
Location: Guatemala

Re: Lost connection to MySQL server during query

Postby nageswaragunupudi » Sat Jul 29, 2023 7:02 pm

csincuir wrote:Hi Vilian
You can check if the "my.cnf" file has this line:
wait_timeout=28800

Best regards

Carlos

TimeOut is not at all a problem for FWHmaria library
Yes, after the time out period, the connection with the sever is lost.
Even then, if the user's operation requires, the library will again connect to the server and proceed.
Whether you set time our not, nothing can stop our program.

Only if the PC can not communicate with the server for other reasons physical or lack of internet, this message is displayed
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Lost connection to MySQL server during query

Postby vilian » Sun Jul 30, 2023 7:39 pm

nageswaragunupudi wrote:What is your implementation please?

I just try after the command if nError <> 0, and in this case, I repeat the the command. Something like this:

Code: Select all  Expand view

          oQry := oBD:Query("SELECT * FROM ttartes LIMIT 1")
          IF (nRet := ::CheckBD()) < 0
                    RETURN lRet
          ELSEIF nRet = 1    
                    oQry := oBD:Query("SELECT * FROM ttartes LIMIT 1")
          ENDIF  

METHOD CheckBD() CLASS TTarTes

   IF oEmpresa:oBD:nError == 0
          RETURN 0

   ELSEIF oEmpresa:oBD:Connect()  
          RETURN 1
   ELSE
          MsgInfo("Ocorreu uma falha na conexão com o BD com a seguinte mensagem:"+CRLF+oEmpresa:oBD:cError,"Atenção")  
   ENDIF  
RETURN -1  
 


So, if possible, i wanted to avoid this message.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 972
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Lost connection to MySQL server during query

Postby vilian » Mon Jul 31, 2023 1:27 pm

Is it possible ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 972
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Lost connection to MySQL server during query

Postby Maurizio » Mon Jul 31, 2023 2:50 pm

This can work if you use only a table.

However, if you had previously opened other tables, do you find them closed?

It is a problem that even when the internet connection is not stable

Maurzio
User avatar
Maurizio
 
Posts: 823
Joined: Mon Oct 10, 2005 1:29 pm

Re: Lost connection to MySQL server during query

Postby vilian » Mon Jul 31, 2023 4:39 pm

Maurizio,
I understood what you are saying, but in this case, I'm always checking for errors, so i really dont need this message. This is just disturbing my customer and me too.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 972
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Lost connection to MySQL server during query

Postby nageswaragunupudi » Tue Aug 01, 2023 3:49 am

Mr. Vilian
You do not need to write any code to check the errors.
FWH Library already does it for you.
You do not need to repeat in your code, what FWH library has already done it.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Lost connection to MySQL server during query

Postby vilian » Tue Aug 01, 2023 10:44 am

Sorry, but if i don't do this, every time i had a "Lost Connection", i will have an error message. So, with this code i can avoid the error message, but i can't avoid "Lost connection" message.
Please, provide something to avoid it.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 972
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Lost connection to MySQL server during query

Postby nageswaragunupudi » Tue Aug 01, 2023 9:46 pm

vilian wrote:Sorry, but if i don't do this, every time i had a "Lost Connection", i will have an error message. So, with this code i can avoid the error message, but i can't avoid "Lost connection" message.
Please, provide something to avoid it.


If not our "lost connection" message, you are giving your own custom message. Right?
We can provide for showing your custom message instead of the library's built in message.
Is that okay?

But please keep in mind, you do not need to try to reconnect.
All that kind of work, the library has already done.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Lost connection to MySQL server during query

Postby vilian » Tue Aug 01, 2023 11:56 pm

No my friend. I dont want my own custom message. I just wanted recover the conexion with the mysql server and continue running without show any message.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 972
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Lost connection to MySQL server during query

Postby ShumingWang » Wed Aug 02, 2023 3:08 am

Some viruses or trojans can cut down connection.
Your connecting line may with serious problem, our customers use tmysql 20 years with no the problem in normal via bandwidth >0.2M bits .
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Re: Lost connection to MySQL server during query

Postby Maurizio » Wed Aug 02, 2023 7:56 am

Sorry Shuming ,
your comment does not help to solve the problem ,
but above all it is your situation that is not the same for everyone

Maurizio
User avatar
Maurizio
 
Posts: 823
Joined: Mon Oct 10, 2005 1:29 pm

Re: Lost connection to MySQL server during query

Postby vilian » Fri Aug 04, 2023 5:08 pm

Good Afternoon Mr Rao,

IF I try to do this:

oRs := oBD:Query("SELECT * FROM customers")
oRs:SetOrder("name")

And the mysql connection has been lost, there will be an error in oRs:SetOrder("name"), like this:

ERROR BASE/1004 Message not found NIL:SetOrder

What should I to do for avoid this error and allow my program continue running?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 972
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 35 guests

cron