Why can't I open a SQL Server CE database read-only when the SDF file has permissions that allow read-only?

232 Views Asked by At

I'm trying to open a .SDF file using SQL Server CE 4.0 SP1. The .SDF file lives in C:\Program Files (x86). The permissions are set up so that normal users have read & execute permissions on the file. The client program is running as a regular user and tries to open the .SDF using this connection string:

"Data Source='{path-to-database-file}'; Password='{password}'; Max Database Size=4000;Mode=Read Only;Temp Path={users-temp-path};"

Opening a connection using that connection string results in

Internal error: Cannot open the shared memory region

The same code, when run as administrator, works perfectly.

If I add Modify & Write for all Users, it works perfectly as a regular user.

If I move the file to an app data folder, it works perfectly for that regular user.

Based on this evidence it looks like SQL Server CE cannot open a file for read only without the ability to write to the file.

Based on customer requirements nothing in C:\Program Files (x86) can be writable to regular users and all regular users need read-only access to the file.

What's up? What am I missing? Is this just not possible?

Thanks.

0

There are 0 best solutions below