Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server CE / November 2008

Tip: Looking for answers? Try searching our database.

Connections usage in a multi-thread environment

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Serge Wautier - 27 Nov 2008 11:37 GMT
Env.: SQLCE Mobile 3.5 / WM6 / CF 2.0

Hi All,

My app makes extensive use of SQLCE.

User operations (foreground thread) use a connection object that stays alive
and opened all of the time for performances reasons (I tried to close the
connection after each access but testers immediately noticed the significant
slowdown).

The app also periodically starts temporary background threads that collect
info from the DB to send it to a server.

Q: Is it safe to use the same SqlCeConnection already used by the foreground
thread (Concurrent accesses by foreground and background threads WILL
occur)? Or should I use another object instance in the background threads?

Q: Is there any issue with keeping a connection opened all of the time
(memory usage, garbage collection of commands, whatever...)?

TIA for any lights you may shed.

Regards,

Serge.
Ginny Caughey MVP - 27 Nov 2008 12:38 GMT
Serge,

You should use a separate connection for each thread. Keeping the foreground
thread's connection open should not be a problem however unless a background
connection needs exclusive access to the database for compactions, etc.

Signature

Ginny Caughey
Device Application Development MVP

> Env.: SQLCE Mobile 3.5 / WM6 / CF 2.0
>
[quoted text clipped - 23 lines]
>
> Serge.
Serge Wautier - 27 Nov 2008 14:53 GMT
Ginny,

Thanks for your answer.

Serge.

> Serge,
>
[quoted text clipped - 30 lines]
>>
>> Serge.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.