I get this error when trying to connect to my database using SQL Management Studio 2008. “The server principal “username” is not able to access the database “database_name” under the current security context. (Microsoft SQL Server, Error: 916)”.
This error can be encountered when connecting to either SQL 2005 or SQL 2008 databases using SQL 2008 Management Studio.
As you may notice, the error message indicates a problem connecting to a database that you do not own. This is caused by SQL 2008 Management Studio attempting to query certain system settings that customers do not have access to.
To resolve this issue do the following:
1. Open SQL Management Studio 2008 on your local Computer
2. In the Object Explorer, click “Databases”
3. Select View >>> Object Explorer Details
4. Right click on the column headers
5. And Uncheck the Following Items:
Database Space Used (KB)
Index Space Used (KB)
Space Available (KB)
Default File Group
6. Right click on Databases and select Refresh to fix the error.
1. In order to ‘Map’ the Login, the Login must not already be as User on the database.
Go to ServerName -> Databases -> DatabaseName -> Security -> Users
2. Delete the Login from the list of database Users before mapping the Login to the database.
3. In Object Explorer -> Server -> Security -> Logins, right click and choose Properties
4. The ‘User Mapping’ page should list all databases on the server with a check mark on the databases that the Login has been mapped to.
Map the Login by checking the box next to the database name.
You may also need to add some fixed database roles, just to get your stuff working first:
ie, db_datareader and public.
5. Click OK