Marcom
Marcom

Reputation: 4741

Sql ce 3.0 Database multiuser

Im trying to access a Sql CE 2005 database on a windows mobile device from two different applciations.

From the information I found online it should work but when I open the second connection I get a file sharing violation error

"There is a file sharing violation. A different process might be using the file. [ \\\Program Files\xx\DB.sdf ]"

Any ideas on what I'm doing wrong??

Upvotes: 1

Views: 3750

Answers (5)

Ram
Ram

Reputation: 16804

ref: http://msdn.microsoft.com/en-us/library/ms171750.aspx

//In SQL Server Compact, you can run multiple simultaneous applications that are accessing or modifying DIFFERENT sets of data.

The reason why many people get misled i think is since sql ce support multiple connections they use it for senarios to modify same set of data with multiple connections which sql server CE doesnt support.

Hope this helps!

Upvotes: 0

Merc
Merc

Reputation: 1

SQLCE 4 Community Technology Preview is out. It supports multi user scenario and access from multiple threads of the same process.

It does not suffer from the same problems as SQlCE 3.5. Works well on 256 connections.

Upvotes: 0

Marcom
Marcom

Reputation: 4741

The problem was the connection string .....

"Data Source=\\\Program Files\xx\DB.sdf" apparently opens the database as a single user

using

"Data Source=Program Files\xx\DB.sdf" opens the database normally...

Upvotes: 3

ctacke
ctacke

Reputation: 67168

SQL Compact does support multiple connections to the database, even back with version 3.0. How is the first process opening the database? For example, the mobile Query Analyzer from 3.0 and 3.1 did open the database exclusively, effectively locking it from any other process.

Upvotes: 3

sivaramakrishna
sivaramakrishna

Reputation: 676

Is it same process is using multiple threads to access this sdf file, or only one thread. When it says some other "PROCESS" is accessing the file, what is it? Is it VS, or something else. I think you can use the remote process viewer to see which processes in the device are using this SDF file. If you could see seperately which handles are for which processes in a device, that would be great. Even otherwise, just try to delete the sdf file (or move/rename it), after killing some processes on the desktop. That might tell you what is the offending process.

Upvotes: 0

Related Questions