Changing Passwords and Encryption Settings for a Database

When the encryption or password properties on a Microsoft SQL Server Compact 3.5 (SQL Server Compact 3.5) database have been set, these properties can only be modified when the database is compacted.

Besides setting these security properties on the database, the compact feature is primarily used to compress unused space in a database and to search for database consistency errors. For more information, see Maintaining Databases (SQL Server Compact).

You can compact SQL Server Compact 3.5 databases by using the following mechanisms:

Note

When you compact a password protected or encrypted database, you must specify the password for the original database.

  • The CompactDatabase method on the Engine object for OLE DB.
    For more information, see CompactDatabase Method (SQL Server Compact).
  • The Compact method of the System.Data.Sqlserverce.SqlCeEngine class of the .NET Compact Framework Data Provider.

Note   SQL Server Management Studio lets you modify the password and encrypt a database by selecting an option in the Database Properties dialog box. For more information, see How to: Secure a Database (SQL Server Management Studio).