CommandTimeout with DB2 not working
From: Doug Cleven (d_cleven_at_hotmail.com)
Date: 06/08/04
- Next message: Jeff Weyrum: "Re: Memory "leaking" from ADO!!! Help!"
- Previous message: Ed: "how to retrieve RecordsAffected Count from SP?"
- Messages sorted by: [ date ] [ thread ]
Date: 8 Jun 2004 12:12:14 -0700
I'm using ADO to connect to a DB2 v8.1.5 db running on Linux RH 3.0.
The problem I'm seeing is no exception is thrown when the command
times out.
I am converting an application from using SQL Server to using DB2. I
am using the IBMDADB2 OLE DB connection.
I set the connection->CommandTimeout = 30.
I then expect to catch an exception if the command takes longer than
30 seconds.
This worked fine with SQL Server, but does not with DB2. It simply
returns after 30 seconds with an empty recordset. I create the timeout
by explictiy locking the table (using a DB2 command window) I'm
querying so that the query is blocked.
C++ Code snippets:
strCon.Format(_T("Provider=IBMDADB2;HOSTNAME=%s;PORT=50000;PROTOCOL=TCPIP;Database=%s;UID=%s;PWD=%s;AUTOCOMMIT=0"),
server, database, uid, pw);
spCon->ConnectionString = (LPCTSTR)strCon;
spCon->CommandTimeout = 30;
hrOpen = openConnection(spCon, btEmpty, btEmpty, btEmpty, -1);
...
try
{
// this is where I expect to see the exception thrown when it times
out
HRESULT hr = recordSet->Open(Source, (_Connection*)ActiveConnection,
CursorType,LockType,Options);
return hr;
}
catch(_com_error& e)
{
...
}
d_cleven@hotmail.com
- Next message: Jeff Weyrum: "Re: Memory "leaking" from ADO!!! Help!"
- Previous message: Ed: "how to retrieve RecordsAffected Count from SP?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|