ODBC with VC++
-
I'm developing an app that opens a connection to a database and makes a massive import to many tables of it. To do that I open and close the tables several times in some loop statements. The problem is that, when I open a table the service of the sql server (sqlservr.exe) increases the usage of the cpu it uses. When I close the table it should release the resources, but it doesn't! Does anyone know if there is a setting of the sql server that must be changed to do that? Thanks in advance sirtimid
-
I'm developing an app that opens a connection to a database and makes a massive import to many tables of it. To do that I open and close the tables several times in some loop statements. The problem is that, when I open a table the service of the sql server (sqlservr.exe) increases the usage of the cpu it uses. When I close the table it should release the resources, but it doesn't! Does anyone know if there is a setting of the sql server that must be changed to do that? Thanks in advance sirtimid
sirtimid wrote:
The problem is that, when I open a table the service of the sql server (sqlservr.exe) increases the usage of the cpu it uses. When I close the table it should release the resources, but it doesn't!
So are you concerned with CPU usage, or resource consumption?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
sirtimid wrote:
The problem is that, when I open a table the service of the sql server (sqlservr.exe) increases the usage of the cpu it uses. When I close the table it should release the resources, but it doesn't!
So are you concerned with CPU usage, or resource consumption?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
I mean the CPU usage. So, after plenty opens of tables I have serious memory problems!!! Thanks sirtimid
So is it the high CPU usage, or the serious memory problems that are bothering you? It's been five years since I've used SQL Server but I do recall it having a good profiler. SQL Server, in and of itself, is a very big application. For it to continue to tax the CPU even after you've closed a table is not surprising. I would not expect that to continue for any longer than a minute or so. Memory consumption is different, however. The number(s) you see in Task Manager are a bit misleading. Read the last part of this article for an explanation.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
I'm developing an app that opens a connection to a database and makes a massive import to many tables of it. To do that I open and close the tables several times in some loop statements. The problem is that, when I open a table the service of the sql server (sqlservr.exe) increases the usage of the cpu it uses. When I close the table it should release the resources, but it doesn't! Does anyone know if there is a setting of the sql server that must be changed to do that? Thanks in advance sirtimid
One problem with this sort of question is that there are so many ways to access ODBC from C++. If you are calling the SQL API with functions such as SQLExecDirect then you must remember to call SQLFreeStmt SQLDisconnect and SQLFreeConnect Also, check to see if the CPU is freed up after your program terminates. This would be an indication that the program clean up is doing something that you are forgetting to. Scooter