Re: Memory problem - writing to database

From: Paul fpvt2 (Paulfpvt2_at_discussions.microsoft.com)
Date: 12/23/04


Date: Thu, 23 Dec 2004 11:57:05 -0800

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: SQL CE 3.5 and Data Loss on SD Card
    ... with a database on SD card I would be greatful. ... devices we have experienced only one corrupted SDF database. ... I attribute our success to opening a connection just before every DB access ...
    (microsoft.public.sqlserver.ce)
  • Re: ADO Connection Timeout
    ... so what happens when a connection failure forces one station to revert ... to a local database? ... Further, you *will* have contention issues, Jet does not support record ... to the central server, but you are willing to live with periods where it ...
    (microsoft.public.data.ado)
  • Project ODBC Performance
    ... doing a File Open and Save As when using a MS SQL Server database? ... The problem seems to lie in network utilization or ODBC ... have no issue opening the 5MB file but none of them has been successful ... Is there a way to optimize the ODBC connection between the ...
    (microsoft.public.project.vba)
  • Project ODBC Performance
    ... doing a File Open and Save As when using a MS SQL Server database? ... The problem seems to lie in network utilization or ODBC ... have no issue opening the 5MB file but none of them has been successful ... Is there a way to optimize the ODBC connection between the ...
    (microsoft.public.project.standard_and_server)
  • Re: Function OpenConn
    ... a database connection at all, and therefore don't need to call the function. ... While logic will tell us that opening the connection and closing it as soon ... > function OpenConn() ...
    (microsoft.public.inetserver.asp.db)