LocalFailover not working for ExecSQL?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
crafty
Posts: 15
Joined: Thu 30 Aug 2007 15:34

LocalFailover not working for ExecSQL?

Post by crafty » Fri 14 Mar 2008 13:39

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

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 14 Mar 2008 16:08

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.

Post Reply