Re: Memory problem - writing to database

From: Paul fpvt2 (anonymous_at_discussions.microsoft.com)
Date: 12/25/04


Date: Fri, 24 Dec 2004 21:55:42 -0800

Thank you for your reply.
>I don't know whether you have gone with keeping a
>connection open to execute your SP on, or opening and
>closing them, but it seems like you have got it
>sorted.
Currently, I have the connection open in the beginning of
the program and leave it open. I will try it with opening
and closing them as data comes in.

>But I think it was the recordset that was causing you so
>much grief.
Yes, it was the recordset, because now the memory usage
stays the same and it does not increase.

Thank you very much.

>-----Original Message-----
>When I say open a connection every time and close it
when you are done with
>it, I meant you to do this *aswell as* Brian's idea of
using an SP, not
>instead of.
>I don't know whether you have gone with keeping a
connection open to execute
>your SP on, or opening and closing them, but it seems
like you have got it
>sorted.
>But I think it was the recordset that was causing you so
much grief. I
>always tend to shy away from dynamic updateable
recordsets, especially when
>they're got from a "select" statement rather than table-
direct. The SP makes
>sense though as it means SQL server doesn't have to keep
parsing INSERT
>statements, which offers much more of a performance gain
in this situation
>where you have a lot of frequent operations as opposed
to one long one.
>
>"Paul fpvt2" <Paulfpvt2@discussions.microsoft.com> wrote
in message
>news:6E76464C-E175-4F76-B4CF-
8A75B0E0E562@microsoft.com...
>> Thank you.
>>>which is to open a new connection for every new piece
of
>>> data, and importantly, make sure you close it as soon
as the data is
>>> inserted.
>> Does not opening and closing db connection slow down
the program ? Does it
>> take a lot of resource to keep opening and closing the
db connection ?
>>
>> "Bonj" wrote:
>>
>>> > If I do not have the recordset open all the time, I
will need to query
>>> > the
>>> > database again to add a new record. I do not want
to do this, because
>>> > it
>>> > will
>>> > take a long time to query the database (the db can
have up to 10
>>> > million
>>> > records).
>>>
>>> Don't use a recordset to add new data. Instead, fire
off an "INSERT"
>>> statement.
>>>
>>> > I have to keep the connection open all the time also
>>>
>>> You don't.
>>>
>>> > , because data is coming
>>> > in every milliseconds, and as the data comes in, I
need to write all of
>>> > them
>>> > to the database.
>>>
>>> Try my suggestion - which is to open a new connection
for every new piece
>>> of
>>> data, and importantly, make sure you close it as soon
as the data is
>>> inserted. The connection should be opened as late as
possible and closed
>>> as
>>> soon as possible.
>>>
>>>
>>>
>
>
>.
>



Relevant Pages

  • Re: UPDATE query in Access 2003 raising error
    ... I have tried not opening the recordset but still get the same error message ... to open a recordset using it, as opposed to simply using the Execute ...
    (microsoft.public.access.formscoding)
  • Re: Word 2000 size limitations
    ... Win XP, Word 2007, dual-core PC: ... When opening the document, Word takes up to a couple of minutes to count the ... When closing a document, nothing seems to happen sometimes. ... If you have no 2003 pro at hand, try a round-trip save through HTML or RTF. ...
    (microsoft.public.word.docmanagement)
  • Re: Closing of Word Application
    ... With regards to opening ang closing the Word Application, ... cycle through printing the files or Opening and closing ...
    (microsoft.public.access.modulesdaovba)
  • Re: Error message when closing Word 2007
    ... If it does it when opening other documents and closing Word but it is OK in Safe Mode, it suggests an incompatible third party add-in as the most likely cause. ... Something else that I have discovered, I just used Remote Desktop to connect ... >> the error message I get when I shut down Word. ...
    (microsoft.public.word.application.errors)
  • Forms missing from "All Forms" in Customize
    ... After opening those new forms a number of ... design is to close the database and re-open ... closing the forms and cannot make the tables lock up. ... It is all very bizarre and confusing. ...
    (microsoft.public.access.forms)