Multiple simultaneous SQL CE transactions

  • Thread starter Thread starter Jon Skeet [C# MVP]
  • Start date Start date
J

Jon Skeet [C# MVP]

Can SQL CE handle multiple transactions on the same connection? I've
just been implementing a logger which writes its log entries to the
database. It works fine when there's no "active transaction" but it's a
bit of a pain if I can't write log entries within database code...

(One alternative would be to buffer up entries, of course, but that's
slightly unwieldy.)
 
Jon Skeet said:
Can SQL CE handle multiple transactions on the same connection? I've
just been implementing a logger which writes its log entries to the
database. It works fine when there's no "active transaction" but it's a
bit of a pain if I can't write log entries within database code...

Okay, after playing around a bit the answer seems to definitely be
"no", especially with the exception I've managed to get in the end:

"SQL Server CE does not support parallel transactions."

That seems pretty definitive :(

So, does anyone have any experience of dealing with this? I suppose I
could have another database just for the log - presumably I can have
two different connections open at a time, but only one to any
particular database?
 
Jon, SSCE will only allow one connection to a data file at a time. SSCE 3.0
will address this issue allowing multiple simultaneous connections from
within an application and from other applications.

I have previously dealt with this by making a copy of the main SDF file and
working it from that angle.

Bob
 
Jon, SSCE will only allow one connection to a data file at a time. SSCE 3.0
will address this issue allowing multiple simultaneous connections from
within an application and from other applications.

Great - when it comes out :)
I have previously dealt with this by making a copy of the main SDF file and
working it from that angle.

So you can have two connections, one to each of two different
databases? That's worth bearing in mind.

For the moment, I'm just going to keep a circular buffer of log
messages and hope that sooner or later I can write them :)
 
Back
Top