Not enough storage is available to process this command



I have written a DLL in C++/ATL (Visual Studio 6.0) that connects to
different databases using ADO smart pointers (_ConnectionPtr and
_RecordsetPtr). I am connecting to one MS Access database among
others, and it is that connection that gives me a headache. I can call
the function in this DLL with the same parameters about 1000 times
before an exception is thrown with the error in the subject. The code
to open each connection is:

******** CODE *********

bool CPE::OpenConnection(int connIndx)
{
HRESULT hr = S_OK;
try
{
if(m_connArr[connIndx] == NULL)
{
hr = m_connArr[connIndx].CreateInstance(__uuidof(Connection));
if(hr != S_OK)
{
return false;
}
}

if(hr == S_OK && m_connArr[connIndx]->State != adStateOpen)
{
m_connArr[connIndx]->CursorLocation = adUseClient;
hr = m_connArr[connIndx]->Open(m_connStrArr[connIndx], "", "",
-1);
if(hr != S_OK)
{
return false;
}
}
}
catch(_com_error &err)
{
return false;
}
return true;
}

******** CODE *********

The connIndex is an index into both an array of _ConnectionPtr
(m_connArr) objects and an array of _bstr_t:s (m_connStrArr) that holds
the connections strings for the corresponding connection. The call to
open the recordset goes like:

******** CODE *********

if(pRs == NULL)
{
hr = pRs.CreateInstance(__uuidof(Recordset));
}

pRs->CursorLocation = adUseClient;

pRs->Open(sql, m_connArr[ConnIndex].GetInterfacePtr(), adOpenStatic,
adLockOptimistic, -1);

pRs->putref_ActiveConnection(NULL);

******** CODE *********

Both sql and ConnIndex are parameters to the function where this call
is made from.

Can anyone see anything wrong in this code, or at least have any ideas
how to go about tracking down the problem further? I have debug code
that logs all open and close of the recordsets and connections, and
they do match after each call to the DLL. I am only opening/closing
each of the connections once during the lifetime of the DLL. Does a
connection have a "life span", so I need to close it and re-open it
once in a while. One obvious problem would be that there isn't enough
disk space or memory, but there are plenty of both, so I don't think
that is it.

Any help would be much appreciated,

TK

.



Relevant Pages

  • problems accesing csv via jet oledb
    ... I try to access a cvs-file with ms jet oledb 4. ... create a connection and a _RecordSetPtr. ...
    (microsoft.public.data.oledb)
  • RE: svchost.exe Application Error.
    ... Description: Net Win32 API DLL ... P.S the NetBio over TCP/IP is on the Internet Protocol TCP/IP properties, ... you gone to the Network connection and Right click your Wireless/Wired LAN, ...
    (microsoft.public.windowsxp.network_web)
  • RE: svchost.exe Application Error.
    ... Description: Net Win32 API DLL ... P.S the NetBio over TCP/IP is on the Internet Protocol TCP/IP properties, ... you gone to the Network connection and Right click your Wireless/Wired LAN, ...
    (microsoft.public.windowsxp.network_web)
  • RE: svchost.exe Application Error.
    ... Description: Net Win32 API DLL ... P.S the NetBio over TCP/IP is on the Internet Protocol TCP/IP properties, ... you gone to the Network connection and Right click your Wireless/Wired LAN, ...
    (microsoft.public.windowsxp.network_web)
  • Re: Getting Calling Thread (DLL) Module Name
    ... > called the server). ... connection information for all context for various ideas; ... the name of the DLL, We just know the program name. ... In the above snapshot, where there is an HTTP connection type, we know its ...
    (microsoft.public.win32.programmer.kernel)