3

I have a database in SQL Server CE. When connecting several applications of different computers to the database throw an exception.

This is the exception:

There is a file sharing violation. A different process might be using the file. type of exception is "SqlCeException".

and this is my connection string :

Data Source=\\server\ProductionDB\ProductionControl.sdf;File Mode=Read Write; Max Database Size = 4000

The version of SQL Server CE is 3.5 SP2

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
andres
  • 115
  • 1
  • 3
  • 8
  • 1
    What version of SQLCE are you using? It's not possible to have multiple connections pre version 3.5. – OperatorOverload Apr 18 '12 at 15:11
  • 4
    SQL Server CE is **NOT** designed to be used by multiple clients - that's what the **server versions** of SQL Server do. SQL Server CE is a **local** cache/database only. This has changed a bit with SQL Server CE 4.0 - but I'd still argue: if you need to have multiple clients connecting to a database - make it a **server** database! – marc_s Apr 18 '12 at 15:41
  • It also will happen, [when the SDF file is located on a network drive](https://social.msdn.microsoft.com/Forums/sqlserver/en-US/275ed470-52ea-4134-951b-084ab424ebf1/sqlce-file-sharing-violation?forum=sqlce) instead of a local drive and then is accessed from multiple processes simultaneously. – Uwe Keim Apr 16 '19 at 09:15

1 Answers1

8

I misread your question initially, but I don't believe SQL Server CE supports multiple connections from different computers.

From an MS guide:

When you require data service functionality, such as the ability to support multiple, remote users, you should start with SQL Server Express Edition and work up the data service family tree.

You can have multiple connections (up to 256) from the same machine, but connections from multiple machines requires SQL Express Edition. It's freely available and easy to deploy.

Here's the link: http://www.microsoft.com/sqlserver/en/us/editions/express.aspx

OperatorOverload
  • 724
  • 4
  • 17