Application freezes after connection is dead

Application freezes after connection is dead

am 20.07.2006 16:24:39 von rhu

--Alt-Boundary-5992.289331546
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: Quoted-printable
Content-description: Mail message body

Hi,

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 t=
his connection and
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 10.128.64.56 -=
j REJECT

which interrupts the connection (I close the listening port of the databas=
e).

Trying the next SQL-Request with SQLExecDirect leads to a "frozen" applica=
tion, 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 function
to clean up the situation. It means I call SQLDisconnect(). But now this f=
unction 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 obj=
ects (the
deallocation of the handles or a call of SQLDisconnect, SQLConnect, ...) r=
egarding the
connection leads to a non-responding application.

First question: Is there anybody who can tell me how to catch this situati=
on?

Second question: The usage of

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

leads in any case to sqlReturn=3DSQL_ERROR

Why?

Thanks in advance for your help.
Reinhard Hüttermann

------------------------------------------------------------ --------------=
------------------------------------------------
HaCon Ing.-Ges. mbH Hannover, Germany

--Alt-Boundary-5992.289331546--