• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

Memory and handle problems with CDatabase

Greetings,

my program uses CDatabase and CRecordset objects in multiple threads and very frequently. The problem is that memory doesn't seem to be released when I close the database. I do see memory decreasing when I close my recordset objects but not the database.
Also, everytime I call CDatabase->ExecuteSQL for an INSERT query the memory and handle count goes up. Is there some other mehod that has to be called to release resources. Note that I am using CDatabase to connect to a MS Access database via ODBC because it is more thread safe that CDaoDatabase.

Thanks.
0
sinister
Asked:
sinister
  • 3
1 Solution
 
Nicolay_ChCommented:
May be you need to simple call CDaoDatabase->Close()?

Before CRecordset->Close()?

0
 
alechkoCommented:
As said in MSDN then you close the database, it's not released, you can use it again and reopen the connection..
it's for perfomance reasons, some applications always keep connection open, so they have to check if the database is still accessible (mostly with SQL servers which can fall down for a strange reason), some applications always close it's connection to database, so next time you connect, you'll know if database is alive. So in both cases perfomance will be almost the same since CDatabase keeps it's instance unless you destroy it manualy (new and delete). By just closing it will not release the resources it takes.
0
 
sinisterAuthor Commented:
Well, so far our stress testing seems to be going well, I keep the database open all the time. Is there a timeout without the connection that I should be concerned with? Also, if you know of any potential problems that can occur with MS Access through ODBC and CDatabase, I would appreciate it.

Thanks.
0
 
alechkoCommented:
I don't think, I cant see any reason that Access database will not respond, maybe if someone deletes it ?!

Problems... can't think of something...
As far as I know there are some limits of Access database comparing to SQL Server, like the size, number of tables, security... and the most problematic is the speed and number of connections at the same time.

CDatabase & CRecordset works just fine.

Have fun.
0
 
alechkoCommented:
I don't think, I cant see any reason that Access database will not respond, maybe if someone deletes it ?!

Problems... can't think of something...
As far as I know there are some limits of Access database comparing to SQL Server, like the size, number of tables, security... and the most problematic is the speed and number of connections at the same time.

CDatabase & CRecordset works just fine.

Have fun.
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now