Installing SQL Server Compact Edition (v3.1)

SQL Server 2005 Compact Edition is available via a number of Microsoft downloads including:

Knowing which components are required and need to be installed for a given situation is important but can be confusing due to the various ways the SQL Server Compact Edition components can find their way onto your machine.

Installing onto a PDA

If your application makes use of a SQL Server Compact Edition database you must ensure that every PDA it runs on has the SQL Server Compact Edition database engine installed. If your target device is running Windows Mobile 6.0 it should have SQL Server 2005 Compact Edition in ROM, meaning nothing needs to be manually installed.

If your target device does not have a version of SQL Server Compact Edition installed or you would like to ensure that the latest service pack is installed you will need to manually install the database engine via one or more CAB files as part of your application installation process.

There are three different CAB files that make up the SQL Server 2005 Compact Edition product.

  • sqlce30.platform.processor.cab – The actual database engine.
  • sqlce30.repl.platform.processor.cab – An optional component that is required if your application makes use of the Merge Replication or Remote Data Access (RDA) APIs.
  • sqlce30.dev.lang.platform.processor.cab – Additional features for development purposes such as improved error messages for exceptions, and a query analyzer utility that runs directly on a PDA.

Once SQL Server 2005 Compact Edition support has been installed into Visual Studio 2005 (see below) you can find the required CAB files within the %programs%\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v3.0\platform\processor\ folder.

One tricky bit is the fact that references to “platform” and “processor” in file and directory names above need to replaced with values specific to the version of Windows Mobile your target device is utilising.

In general you can use:

  • wce500\armv4i\sqlce30.ppc.wce5.armv4i.CAB – For Windows Mobile 5 Pocket PC or above devices.
  • wce500\armv4i\sqlce30.phone.wce5.armv4i.CAB – For Windows Mobile 5 Smartphone or above devices.

Although you will find support for a range of platforms and processor types within the specified folder.

Installing onto a desktop (or TabletPC, or UMPC etc)

One advance of SQL Server CE with the SQL Server 2005 Compact Edition release is the ability to run the database engine on desktop PCs.

If your target machine does not have Visual Studio 2005 or SQL Server 2005 installed you need to install the SQL Server Compact Edition Runtime (SQLServerCE31-EN.msi) on each machine your application is deployed to. This may be able to be done automatically if you are using Click-Once deployment functionality for your product. Alternatively the MSI can be directly downloaded, or found on your development machine within the %programfiles%\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\SQL Server Compact Edition folder.

Developer Tool Support

Different versions of Visual Studio support different versions of SQL Server CE.

Visual Studio version SQL Server CE version
VS2003 SQL Server 2000 Windows CE Edition (v2.0)
VS2005 (RTM) SQL Server 2005 Mobile Edition (v3.0)
VS2005 (SP1 + update) SQL Server 2005 Compact Edition (v3.1)
VS2008 SQL Server Compact 3.5 (v3.5)

As João Paulo Figueira pointed out SQL Server 2005 Mobile Edition (v3.0) and SQL Server 2005 Compact Edition (v3.1) are both compatible at the file level. The major changes between these two releases related to the high level SQL query processor and the number of platforms supported by the product.

Using the supported version of SQL Server CE for a particular version of Visual Studio means that you get access to all the graphical designers and database manipulation tools within Visual Studio such as Server Explorer and the Data Source Configuration Wizard. It is generally possible to utilise an older or newer version of the SQL Server CE database engine with a given version of Visual Studio, but in doing so you will loose the ability to use the graphical tools.

When Visual Studio 2005 shipped it orignally supported Mobile Edition. In order to update your copy of Visual Studio 2005 to support Compact Edition you need to perform the following steps:

  1. Install Visual Studio 2005 Service Pack 1.
  2. Install SQL Server Compact Edition Runtime.
  3. Install SQL Server Compact Edition Tools for VS2005 SP1.
  4. Optionally install SQL Server Compact Edition Books Online.

The second step of these instructions installs the updated (SQL Server 2005 Compat Edition) database engine, while the third step updates the Visual Studio 2005 user interface. You need to be careful, if you only install Visual Studio 2005 SP1, some elements of the user interface will have been updated, but this is only a change of a couple of strings within the dialog resources. Even though Visual Studio will refer to SQL Server Compact Edition, underneath the covers it is in fact still utilising the SQL Server 2005 Mobile Edition database product. For a more detailed coverage including solutions to the most common problems you may find along the way please review Steve Lasker’s Configuring Visual Studio 2005 for use with SQL Server 2005 Compact Edition blog post.

If you are using a development environment other than Visual Studio, or are looking for a way to obtain the CAB files without needing to install Visual Studio 2005 you could download the SQL Server Compact Edition Developer SDK. This package contains the installers for the SQL Server Compact Edition Runtime, the CAB files required for installation onto a PDA, a local copy of the SQL Server Compact edition Books Online documentation, as well as an example of how to access SQL Server Compact Edition databases in native C++ code.

2 Responses to “Installing SQL Server Compact Edition (v3.1)”

  1. Thanks so much for this highly informative post, it was just what I needed!

  2. Bert says:

    Very helpful. I’ve been trying to find out which files to install on t-mobile wing WCE 6.0

    I’ll give this a shot.

    Thanks,
    Bert

Leave a Reply