List:MySQL ODBC« Previous MessageNext Message »
From:Reinhard Hüttermann Date:July 20 2006 2:24pm
Subject:Application freezes after connection is dead
View as plain text  

Problem description:

I use unixODBC-2.2.8-55 containing the driver manager MyODBC-unixODBC-3.51.06-150 
within a SuSE Linux 9.1 (i586) operating system.

I create handles to open a "permanent" connection to a MySQL database with SQLConnect 
in an application (in this case a middleware). I send SQL-Statements via this connection
receives an answer for each of them. This all works fine.

Then I simulate a problem with the LINUX command:

iptables -A INPUT -p tcp  --destination-port mysql --source -j REJECT

which interrupts the connection (I close the listening port of the database). 

Trying the next SQL-Request with SQLExecDirect leads to a "frozen" application, i.e. the 
function SQLExecDirect never returns.

O.K., then I try to implement a workaround, i.e. I implement a timeout for the call of 
SQLExecDirect to catch the frozen status of the function including a long jump to a
to clean up the situation. It means I call SQLDisconnect(). But now this function never 
returns, so the system is frozen again.

O.K. then I forget the clean up and try to establish a new connection with SQLConnect  and

new handles. But again: the function freezes.  

As a summary: After the connection is dead, every action on one of the objects (the 
deallocation of the handles or a call of SQLDisconnect, SQLConnect, ...) regarding the 
connection leads to a non-responding application.

First question: Is there anybody who can tell me how to catch this situation?

Second question: The usage of 

sqlReturn = SQLGetEnvAttr(this->envHandle, SQL_ATTR_CONNECTION_DEAD,
                              &lConnectionStatus, sizeof(SQLINTEGER), NULL);

leads in any case to sqlReturn=SQL_ERROR


Thanks in advance for your help.
Reinhard Hüttermann

HaCon Ing.-Ges. mbH Hannover, Germany

Application freezes after connection is deadReinhard Hüttermann20 Jul