Hi,
I have a question about writing an application that will reconnect to an
Informix ODBC source if the link is broken, say by the server being rebooted.
I'm using Informix's 32bit ODBC drivers (Intersolv's in disguise) as part of
the CLI package.
At the moment, I connect to the database and detect an disconnection from
the database when I try to insert data and I get the error:
[INTERSOLV][ODBC Informix Driver][Informix]Connection does not exist.
SQL State: S1000 Native Error: -1803
At this point I want to be able to attempt a reconnection to the database.
First I disconnect from the database using:
SQLFreeStmt() - If I have a non-null HSTMT
SQLDisconnect()
SQLFreeConnect()
SQLFreeEnv()
Next the HDBC, HENV and HSTMT variables are all set to their NULL
equivalents (e.g. SQL_NULL_HENV)
Then I attempt to reconnect using:
SQLAllocEnv()
SQLAllocConnect()
SQLConnect()
On performing the SQLConnect() I get an SQLError (Native Error -406) saying
that there was a memory allocation failure.
Is there some step I missed or is there a better way to detect ODBC
disconnection and peform a reconnection?
Performing a connection and disconnection for each insert is not a valid
option.
I'm working in MS Visual C++ 4.1 under NT 3.51 (but using C and the C ODBC
API) and connecting to Online Workgroup Server 7.2 running under NT.
Thanks in advance,
Stephen Garner (stepheng@cse.co.nz)
Systems Engineer
CSE (NZ) Ltd
Hamilton, NZ
--
Stephen R. Garner. stepheng@cse.co.nz
Systems Engineer
Computer Systems Engineering (NZ) Ltd. Ph. (+64) 7 838 2010
Hamilton, NZ. Fax.(+64) 7 838 0977