ODBC Connector 5.1.6 hangs in a specific situation (recv)

ODBC Connector 5.1.6 hangs in a specific situation (recv)

am 24.09.2010 17:06:31 von Bonny Gijzen


I have written a Delphi application which uses ADO to talk to a database.
I first started with an Access database and later I migrated to MySQL using
the ODBC connector 5.1.6

The problem I had was that the application holds the database connection
open during the whole session (could be up to 5 hours), and sometimes the
connection was dropped.

Now I manage to recover from this using the following:
1) Use the AUTORECONNECT flag when connecting to server
2) Set the wait_timeout to 28800 seconds after connection
3) Set the interactive_timeout to 28800 seconds after connection
4) Periodically send a simple query as some sort of keep-alive

Sometimes the connection is still dropped and I get a nice exception, which
I catch and then I recreate the connection, so far so good.

Now very rarily when using a simple query my applications hangs.
The hang happens on recv() in function SQLExecDirectW() which is used by the

Here is a stacktrace to show it:
77a1f85a +00e ntdll.dll NtWaitForSingleObject
76954861 +082 WS2_32.dll recv
6db6a64b +079 ODBC32.dll SQLExecDirectW
004cafa6 +056 BiljartScoreBord.exe ADODB TADOConnection.Execute
0058a8b8 +0b0 BiljartScoreBord.exe Unit2 TForm2.SendServerKeepAlive

For now I have no way to recover from this.
Is it normal that the connector could hang (for a long time) in some

I am now trying to see if I can use the options READTIMEOUT and
WRITETIMEOUT, but there is something confusing me:
The documentations says these options exist but only for server 5.1.12 and
up, but I would think this is an option for the client side (connector) so
how is that related to the server side??

Also it seems my provider is using MySql server version 5.0.91 on Linux :(

Could this be something I am doing wrong?
(As I've said this happens only very rarily but it has happened a couple of
times already. Also for now it happened only on Win 7 machines.)
Could this be a bug?

Does anyone have some insight on what to do now?
I am really stuck here and the application isn't useable if it will hang at
some point it time.

Many thanks in advance for your answers and insights,


MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=gcdmo-myodbc@m.gmane.org