I made an application with SQL Compact Edition 3.5 to be used from many user but in the test I got can't connect to databse after the first one how connected !
this is an erreur in my application or probleme with many connexion in SDF file ?
and what about Compact Edition 3.5 accept 256 connexion!
Depending on how your application behaves, you might be able to replace SQL Compact with SQLite. It can really only handle one write at a time but can handle multiple simultaneous reads. Anything more than that and you should be looking at a real SQL server.
You should look at a Microsoft Locking in SQL Server CE. In a nutshell, it says multi users/application can concurrently access the SDF at the same time provided the database is not locked in a transaction.
Also, I like to mentioned that we also do not have multi user/application access to a SQL Server CE 3.1 file on a network drive. (This constraint may still be true for SQL Server CE 3.5). If you're being affected by this, you will have to ensure your SDF is being opened using a local drive reference.
Related
My C# WPF application using a SQL Server CE 4 database, everything works fine.
But when I want to run multiple instances of that app, I have problem: I can't open more than 1 connection at the same time.
As I understood SQL Server CE does allow multiple reads but only 1 write at a time.
I get an error
there is a file sharing violation a different process might be using the file
What to do to fix it?
If some info is missing tell me about it in a comment
Edit 1:
Tried to add
PRAGMA journal_mode=WAL;
to the connection string but it causes error: Keyword not supported: 'pragma journal_mode'
Edit 2: As I understand Sql CE support more than 1 connection but only from the same PC, what I want to do is to connect to the db on network drive.
What can I do? (I can't use SQL Server Express etc. only single file db)
I had this problem, while ago. Since it is one time go, I used sqlite browser to change pragma for database manually. Let me know if this helped you.
Use the free SQL Server Express if you need a database over a LAN
I have found that SQL Server Compact has been discontinued and that SQL Server Express should be used instead. I have been trying to get it working but have failed so far - I need to use it the same way as SQL Server CE - i.e. to insert a local DB into my app so that the DB will be used automatically wherever my app is deployed (no installation of SQL Server etc.). But I just cannot seem to find the way.
Your looking for an embedded database.
http://en.wikipedia.org/wiki/Embedded_database
I would recommened
SQLite and its .net wrapper is here.
This might sound a silly question but I've really spend hours in trying to find a solution...
I have a local database on SQL Server and it is used with a C# application.. The only way I view the database is through SQL Server.. It is accessible and altered in my application when I am running the application on my developing PC, but when I run it on another PC the database is not found (obviously) .. How can I include the database sources when I am compiling the program, (so that it would be also found when I run it on other PCs) ?
Initially I used SQL Server CE and I achieved portability, but I had to include stored procedures, and this edition doesn't accept them :/ so I had to turn my attention to the latter type.
Sorry for my terrible English ! :(
Thanks in advance
How can I include the database sources when I am compiling the program, (so that it would be also found when I run it on other PCs) ?
You can't. SQL Server license prohibits distributing parts of it like that, plus there is no documented way to do that. If you need SQL Server on the box, it needs to come from the installer. You can create an installer for your own product, and your installer can install SQL Server if it's needed as a prerequisite.
Alternatively, you could look at other database options such as SQLite for a file-based database. You can distribute the components of SQLite.
If you need a local sql server on each pc where your application runs then you should look into the Express edition of MS SQL Server. It is the free with limitations version of MS SQL Server.
Is SQL Server Compact Edition Serverless?
I mean, If I have a Northwind.sdf file in some pc without SQL server installed, can my application still use that?
Is it the same with SQLITE?
Correct.
Both of these databases do not have servers and do not require any installation for end-user.
All you need to do is include the appropriate DLL file
Answer of SLaks + Yes, SQLite is an embedded database too.
SQLite features: SQLite doesn't support RIGHT or OUTER JOIN's, complete ALTER TABLE. See http://www.sqlite.org/omitted.html.
I created a small application using C# winforms that uses SQL Server as a database.
Is there a way to attach the database to the exe file so I won't need to install SQL Server on all the machines that I want to run the program on?
As far as I know, that's where SQL Server Compact comes into play.
Quoting the Wikipedia article:
Unlike other editions of Microsoft SQL Server, SQL CE runs in-process with the application which is hosting it; while having a memory footprint of less than 2 MB;
in addition to sql server compact, there is also a c# port of sqlite that you could use.
Have you seen SQL Server Compact?
It's a Zero-config, single file version of SQL Server.
You can use SQL Server compact:
http://www.microsoft.com/sqlserver/2008/en/us/compact.aspx
or SQLite:
http://www.sqlite.org/
- it has a .NET library that you can download and use...it's pretty fast and compact
You can included it as part of the app installer. See this article