Page 1 of 1

LocalFailover not working for ExecSQL?

Posted: Fri 14 Mar 2008 13:39
by crafty
Hello,

I've faced a strange behaviour of LocalFailover. It looks like if it works for TMyQuery.Execute but doesn't work for TMyConnection.ExecSQL? The reconnect is done but the query isn't sent.

In TMyConncection I have:
LocalFailover=true
RetryMode := rmReconnectExecute (in OnConnectionLost)

When calling TMyQuery.Execute (when connection was lost) I get:

Code: Select all

Exception class EMySqlException with message 'Lost connection to MySQL server during query 
Socket error on write. WSAGetLastError return 10054($2746)'
Exception class EMySqlException with message 'Lost connection to MySQL server during query
Socket error on write. WSAGetLastError return 10054($2746)'
Exception class EFailOver with message ''
And the query is sent to database.

When calling TMyConnection.ExecSQL (when connection was lost) I get:

Code: Select all

Exception class EMySqlException with message 'Lost connection to MySQL server during query
Socket error on write. WSAGetLastError return 10054($2746)'
Exception class EMySqlException with message 'Lost connection to MySQL server during query
Socket error on write. WSAGetLastError return 10054($2746)'
Exception class EMyError with message 'Lost connection to MySQL server during query
Socket error on write. WSAGetLastError return 10054($2746)'
And the query is not sent to database.

Regards,
Crafty

Posted: Fri 14 Mar 2008 16:08
by Antaeus
This happens because TMyConnection.ExecSQL is the fastest way for queries execution. Therefore it does not support monitoring and reexecuting queries.
You should use the TMyCommand component instead.