>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