Connecting Tech Pros Worldwide Forums | Help | Site Map

Saving to data base

aaa
Guest
 
Posts: n/a
#1: Aug 24 '06
How can I save data without connecting to data base every time a client's
request
arrives?
If I work on a temporary memory I cannot work with sql queries, but connecting
to data base takes time.


r norman
Guest
 
Posts: n/a
#2: Aug 24 '06

re: Saving to data base


On Thu, 24 Aug 2006 04:31:01 -0700, aaa
<aaa@discussions.microsoft.comwrote:
Quote:
>How can I save data without connecting to data base every time a client's
>request
>arrives?
>If I work on a temporary memory I cannot work with sql queries, but connecting
>to data base takes time.
If all you need to do is save the data and not query the database on
each request, just buffer the data in temporary memory and flush it
out to the database at intervals. I use a separate thread to access
the database and flush the accumulated data so as not to interfere
with ongoing data collection. That way, it doesn't really matter if
the database is occasionally a bit slow.




Markus
Guest
 
Posts: n/a
#3: Aug 24 '06

re: Saving to data base


>How can I save data without connecting to data base every time a
Quote:
Quote:
>client's request arrives? If I work on a temporary memory I cannot
>work with sql queries, but connecting to data base takes time.
>
If all you need to do is save the data and not query the database on
each request, just buffer the data in temporary memory and flush it
out to the database at intervals. I use a separate thread to access
the database and flush the accumulated data so as not to interfere
with ongoing data collection. That way, it doesn't really matter if
the database is occasionally a bit slow.
Just keep in mind, that in case of system crashes your data, which are
not written to the database, are not available anymore. So I think it's
depending on your use case, for most situations this is fine, but if you
go into some user login, accounting or similar, then it is crucial, that
the data the user submits really get written to the database, or if an
error occurs there, that the user is notified immediately of the error.

Markus
Nick Malik [Microsoft]
Guest
 
Posts: n/a
#4: Aug 25 '06

re: Saving to data base


"aaa" <aaa@discussions.microsoft.comwrote in message
news:5306AC19-5B04-49BD-8FFF-B797BE4B2551@microsoft.com...
Quote:
How can I save data without connecting to data base every time a client's
request
arrives?
If I work on a temporary memory I cannot work with sql queries, but
connecting
to data base takes time.
>
If you use the same connection string every time, then connection pooling
should take care of most of the delays caused by logging in. I assume you
are using SQL Server or SQL Server Express (the free version). Other
databases, like MySQL, may or may not offer this feature.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--


Closed Thread