query failed
Posted
#1
(In Topic #2037)
Regular

If my user stays on the screen for a while without confirming anything, during data saving,
I get this error:
"Query failed: lost connection to MySQL server during query"
How do I reopen the connection?
I tried:
"If conn.Opened = False Then conn.Open"
but without success.
Any ideas?
Regards, Eric
Posted
Expert


I'm in Perth Australia and I connect to a MySQL server in Asia ( somewhere?) and get that disconnect from time to time.
It's a timeout set at the database level which is normally (MySql Official) 30 seconds but I think the Gambas default is 20 seconds.
You can set this higher but it will depend on how it is set up.
I find that fully closing the connection and then doing a reconnect seems to fix the connection issue.
Code
Public Sub OpenRemoteConnection()
$MySQL = New Connection
$MySQL.Close
$MySQL.Timeout = MyTimeOut '<----------<<< Try setting a time out to 100(?) seconds and see if that helps
$MySQL.Type = MyType
$MySQL.Host = MyHost
$MySQL.Login = MyLogon
$MySQL.Password = MyPassword
$MySQL.Port = MyPort
$MySQL.Name = MyDatabaseName
Try
$MySQL.Open
Catch
Message(Error.Text)
End
Cheers - Quin.
I code therefore I am
I code therefore I am
1 guest and 0 members have just viewed this.



