Microsoft SQL Server CE

The following are the properties for connecting to Microsoft SQL Server Compact Edition 4.0. The required properties are identified using the *** characters.

If a connection property value has special characters such as semicolons, single quotes, spaces, etc., then you must quote the value using either single or double quotes.

To connect to CE, set the DataSource property to the path to the CE database file.

AutoShrink Threshold Specify the amount of free space, as a percentage, that is allowed in the SQL Server Compact database before the autoshrink process runs.

Default Lock Escalation Specify the number of database locks that the SQL Server Compact database acquires before it tries to escalate locks.

Default Lock Timeout Specify the default interval, in milliseconds, that a transaction will wait for a lock.

Flush Interval Specify the interval, in seconds, between committed transactions to flush data to disk.

Locale Identifier Specify the Locale ID (LCID) of the SQL Server Compact database.

Max Buffer Size Specify the maximum amount of memory, in kilobytes, that SQL Server Compact uses before flushing data to disk.

Max Database Size Specify the maximum size, in megabytes, of the SQL Server Compact database.

Mode Specify the file mode in which to open the SQL Server Compact database. The default value for this property is Read Write.

The Mode option has four values, as described in the following table.


Read Only

Specifies read-only access to the database.

Read Write

Specifies read/write permission to the database.


Specifies exclusive access to the database.

Shared Read

Specifies that other users can read from the database at the same time.

Persist Security Info Specify whether security information is returned as part of the connection string. The default value for this option is False.

Temp File Directory Specify the location of the SQL Server Compact temporary database file.

Data Source *** Specify the path to the SQL Server Compact database file.

Password Enter optional password for the SQL Server Compact database.

Last updated