SQL Server Compact is an in-process database, which means deployment and operating environment resources are minimized to suit the needs of embedded databases within applications. Because components are in-process, they must run in the same 32- or 64-bit environment. Until the 64-bit release of SQL Server Compact 3.5 Service Pack 1 (SP1), developers were forced to use WOW64 mode by setting TargetPlatform to x86, rather than the default target platform, AnyCPU. The 64-bit release of SQL Server Compact 3.5 SP1 means that developers are no longer required to use WOW64. The format of data in the database is not affected by using 64-bit runtimes. The x64 platform is supported, but Itanium 64 is not supported.
WOW64 is an emulation layer that allows 32-bit applications to work as if they were running on a 32-bit platform. |
Databases created by SQL Server Compact 3.5 SP1 64-bit can be accessed by 32-bit runtimes. Running previous versions on 64-bit platforms is done by running 32-bit editions non-natively, in Windows 32-bit on Windows 64-bit (WOW64) compatibility mode.
The only SQL Server Compact installations that install 64-bit components are the SQL Server Compact runtimes (SSCERuntime-ENU.msi) and the merge replication configuration components (SSCEServerTools-ENU.msi). The 64-bit versions of the installers have the same name as the 32-bit versions. For information about obtaining SQL Server Compact components, see the Readme for Microsoft SQL Server Compact 3.5. The latest version of the readme is available at the Microsoft Download Center.
Side-by-Side Compatibility
SQL Server Compact includes support for side-by-side runtime scenarios. Some versions of the SQL Server Compact runtimes have the ability to run at the same time as other versions that are installed on the same computer. Side-by-side support can be useful if you are required to support older clients using legacy database formats along with more recent formats. Multiple versions of client applications can synchronize using the compatible SQL Server Compact runtimes installed on the server.
SQL Server Compact 3.1 runtimes can be installed next to newer releases of SQL Server Compact including 3.5, 3.5 SP1, and 3.5 64-bit SP1. In instances where SQL Server Compact 3.5 SP1 is installed on a computer already running SQL Server Compact 3.5, the existing installation is upgraded to the newer version. In instances where the runtime installation is the same as the existing runtimes, the installer does not enable the installation option.
In order to allow side-by-side scenarios with SQL Server Compact 3.5 and SQL Server Compact 3.5 SP1 64-bit, install the older version last to avoid upgrading the older version. Side-by-side support for WOW64 and native SQL Server Compact 3.5 SP1 64-bit is possible if the WOW64 instance is installed last.
Using Databases with Legacy Applications
For opening database files created by older versions of SQL Server Compact, SQL Server Compact 3.5 SP1 64-bit has the same database file format support as the 3.5 and 3.5 SP1 32-bit releases. The SQL Server Compact 3.1 database file format is not forward compatible with newer releases of SQL Server Compact. Newer versions, including SQL Server Compact 3.5 SP1 64-bit, are not backward compatible with SQL Server Compact 3.1. For information about upgrading older database files, see Upgrading from Earlier Versions (SQL Server Compact), or Upgrade.
Database files created with SQL Server Compact 3.5 SP1 64-bit are the same format as files created by SQL Server Compact 3.5 and SQL Server Compact 3.5 SP1 32-bit. Although SQL Server Compact 3.5 SP1 64-bit produces the same database file format as SQL Server Compact 3.5, they cannot access the same file at the same time. For more information, see the section later in this topic called "Accessing Resources Concurrently."
Merge Replication Compatibility
The 64-bit SQL Server Database Engine can replicate data using SQL Server Compact 3.5 SP1 32-bit runtimes and 32-bit replication components on Internet Information Services (IIS). This scenario is not affected by the release of native 64-bit runtimes. All existing platform scenarios that include 32-bit runtimes are also supported scenarios when changed to 64-bit runtimes.
SQL Server Management Studio
This section describes 64-bit compatibility for SQL Server Management Studio.
Runtime Compatibility
SQL Server Management Studio 2008 runs in WOW64 mode on 64-bit clients. Because of this, the 32-bit version of SQL Server Compact must be installed to use the tools available within SQL Server Management Studio.
Database File Compatibility
SQL Server Management Studio 2008 supports SQL Server Compact 3.5 (including 3.5 SP1 and 3.5 SP1 64-bit) but will not work with SQL Server Compact 3.1 files. SQL Server Management Studio 2005 supports functionality for SQL Server Compact 3.1, but will not work with SQL Server Compact 3.5 and later files. Both Management Studio 2005 and 2008 can be installed on the same box enabling functionality for both SQL Server Compact database file formats. If SQL Server Management Studio 2005 is used to open SQL Server Compact 3.5 or later, it will display the error message, "Invalid database version."
Visual Studio Server Explorer
This section describes 64-bit compatibility for Visual Studio Server Explorer.
Visual Studio 2010 is the preferred environment for developing desktop applications. Visual Studio 2008 SP1 is preferred for developing smart device applications. Visual Studio 2010 does not have support for developing smart device applications. For more information, see Installing a Development Environment. |
Runtime Compatibility
Visual Studio 2008 and Visual Studio 2010 run in WOW64 mode on 64-bit clients. Because of this, the 32-bit version of SQL Server Compact must be installed to use the tools available within Visual Studio 2008 and Visual Studio 2010.
Database File Compatibility
Visual Studio 2008 and Visual Studio 2010 support SQL Server Compact 3.5 (including 3.5 SP1 and 3.5 SP1 64-bit) but will not work with SQL Server Compact 3.1 files. Visual Studio 2005 supports functionality for SQL Server Compact 3.1, but will not work with SQL Server Compact 3.5 and later files. Both Visual Studio 2005 and Visual Studio 2008 or Visual Studio 2010 can be installed on the same computer enabling functionality for both SQL Server Compact database file formats. If Visual Studio 2005 is used to open SQL Server Compact 3.5 or later, it will display the error message, "Invalid database version."
Accessing Resources Concurrently
SQL Server Compact provides multiple-connection access to a database. Not all scenarios are supported where applications use different versions of SQL Server Compact and connect to the same database.
In the scenario where a SQL Server Compact 3.5 SP1 64-bit application and a SQL Server Compact 3.5 application try to open the same database file, the application opening the database first will succeed. The application opening the database subsequently will fail with the following error: "Incompatible shared memory type."
The 32-bit release of SQL Server Compact 3.5 SP1 works concurrently with the 64-bit release of SQL Server Compact 3.5 SP1, but the initial release of SQL Server Compact 3.5 cannot open the same database concurrently with either the 32 or 64-bit release of SQL Server Compact 3.5 SP1.
Managing Installations and Deployments
Native 64-bit SQL Server Compact runtimes are only available on the Internet. URLs for 64-bit runtimes are available in the following languages:
If all prerequisites are deployed privately, by including the native DLLs directly within your project, the resources must be placed in top-level folders of the project. A folder must be created for each processor architecture type, including x86 and AMD64. Itanium 64 is not supported. To display the processor architecture type for a specified computer, open a command prompt and run the following command:
echo %PROCESSOR_ARCHITECTURE%
To display the same information in a window with VBScript, run the following code:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("SYSTEM")
WScript.Echo WshSysEnv("PROCESSOR_ARCHITECTURE")
For more information about deploying 64-bit applications, see "Deploying 64-bit Applications" in the Visual Studio documentation. For more information about deploying desktop applications built with SQL Server Compact, see Deploying Desktop Applications.
Starting with SQL Server Compact 3.5 Service Pack 2, the 64-bit SQL Server Compact Runtime MSI has been integrated into ClickOnce deployment. If a user installs an application built with SQL Server Compact 3.5 SP2 on a 64-bit system by using ClickOnce technology, and SQL Server Compact 3.5 SP2 was selected as an installation prerequisite by the publisher, then both the 32-bit SQL Server Compact Runtime and the 64-bit SQL Server Compact Runtime are installed. In previous versions of SQL Server Compact 3.5, only the 32-bit SQL Server Compact Runtime was installed. |