FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Lost connection to MySQL server during query
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Lost connection to MySQL server during query
Posted: Fri Jul 28, 2023 08: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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Lost connection to MySQL server during query
Posted: 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
Posts: 476
Joined: Sat Feb 03, 2007 06:36 AM
Re: Lost connection to MySQL server during query
Posted: Sat Jul 29, 2023 05:46 PM

Hi Vilian

You can check if the "my.cnf" file has this line:

wait_timeout=28800

Best regards

Carlos

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Lost connection to MySQL server during query
Posted: Sat Jul 29, 2023 07: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
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Lost connection to MySQL server during query
Posted: Sun Jul 30, 2023 07: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 (fw): Select all Collapse
          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
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Lost connection to MySQL server during query
Posted: Mon Jul 31, 2023 01:27 PM

Is it possible ?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: Lost connection to MySQL server during query
Posted: Mon Jul 31, 2023 02: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

Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Lost connection to MySQL server during query
Posted: Mon Jul 31, 2023 04: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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Lost connection to MySQL server during query
Posted: Tue Aug 01, 2023 03: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
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Lost connection to MySQL server during query
Posted: 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Lost connection to MySQL server during query
Posted: Tue Aug 01, 2023 09: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
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Lost connection to MySQL server during query
Posted: 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
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
Re: Lost connection to MySQL server during query
Posted: Wed Aug 02, 2023 03: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
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: Lost connection to MySQL server during query
Posted: Wed Aug 02, 2023 07: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

Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Lost connection to MySQL server during query
Posted: Fri Aug 04, 2023 05: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