SQL Server Compact

SQL Server Compact 4.0 Logo

Microsoft SQL Server Compact (SQL CE) is a compact relational database produced by Microsoft for applications that run on mobile devices and desktops. Prior to the introduction of the desktop platform, it was known as SQL Server for Windows CE and SQL Server Mobile Edition. The latest release is the SQL Server Compact 4.0[1] supporting .NET Framework 4.0, and dropping support for Windows Mobile in this release.[1][2] It includes both 32-bit and 64-bit native support.[1] SQL CE targets occasionally connected applications and applications with an embedded database.[3] It is free to download and redistribute.[3] An ODBC driver for SQL CE does not exist, nor is one planned. Native applications may use SQL CE via OLE DB.

Overview

SQL Server Compact shares a common API with the other Microsoft SQL Server editions.[4] It also includes ADO.NET providers for data access using ADO.NET APIs, and built-in synchronization capabilities,[3] as well as support for LINQ and Entity Framework. Future releases will unify the synchronization capabilities with Microsoft Synchronization Services.[5] Unlike other editions of Microsoft SQL Server, SQL CE runs in-process[5] with the application which is hosting it. It has a disk footprint of less than 2 MB and a memory footprint of approximately 5 MB.[3] SQL CE is optimized for an architecture where all applications share the same memory pool.[6] Windows Store apps for Windows 8 cannot use SQL Server Compact edition, or any other edition of SQL Server.[7]

Support

SQL CE databases can support ACID-compliance, but do not meet the durability requirement by default because AutoFlush buffers changes in memory (including enlisted ambient transactions and explicit SQL CE transactions that do not override the Commit() call with an CommitMode.Immediate value). Therefore, committed transaction changes can be lost. To meet the durability requirement the commit call on the transaction must specify the immediate flag.[8] Like Microsoft SQL Server, SQL CE supports transactions, referential integrity constraints, locking as well as multiple connections to the database store.[4] However, nested transactions are not supported, even though parallel transactions (on different tables) are.[9] The current release does not support stored procedures[4] or native XML data type either.[5] It uses a subset of T-SQL[3] for querying and due to lack of XML support, XQuery is not supported either.[5] Queries are processed by an optimizing query processor.[10] SQL CE databases also support indexing, as well as support remote data replication (local caching of data in remote databases) and merge replication (bidirectional synchronization with master databases).[11]

SQL CE databases can be created and managed from Microsoft Visual Studio and some older versions of SQL Server Management Studio as well.[10]

File format

SQL Server Compact
Filename extension .sdf
Developed by Microsoft
Type of format Relational database

SQL CE databases reside in a single .sdf file,[12] which can be up to 4 GB in size.[4] The .sdf file can be encrypted with 128-bit encryption for data security.[12] SQL CE runtime mediates concurrent multi-user access to the .sdf file. The .sdf file can simply be copied to the destination system for deployment, or be deployed through ClickOnce. SQL CE runtime has support for DataDirectories.[6] Applications using an SQL CE database need not specify the entire path to an .sdf file in the ADO.NET connection string, rather it can be specified as |DataDirectory|\<database_name>.sdf, defining the data directory (where the .sdf database file resides) being defined in the assembly manifest for the application.

SQL Server Management Studio 2005 can read and modify CE 3.0 and 3.1 database files (with the latest service pack), but SQL Server Management Studio 2008 (or later) is required to read version 3.5 files. Microsoft Visual Studio Express 2008 SP1 can create, modify, and query CE 3.5 SP1 database files. SQL Server Management Studio cannot read CE 4.0 files. Visual Studio 2010 SP1 can handle CE 4.0 database files.

The .sdf ("Sqlce Database File") naming convention is optional, and any extension can be used.

Setting a password for the database file is optional. The database can be compressed and repaired with the option of the compacted/repaired database to be placed into a new database file.

Deprecation

In February 2013, Microsoft announced that SQL Server Compact Edition had been deprecated.[13]

Although no new versions or updates are planned, Microsoft will continue to support SQL Compact through their standard lifecycle support policy.

See also

References

This article is issued from Wikipedia - version of the 11/12/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.