If you’re trying to open an Office Document in SharePoint 2010 with the included WebApps you might encounter the following error in the diag log/screen:
Corresponding diag log entry:
System.Data.SqlClient.SqlException: Cannot open database "CONTENTDB" requested by the login. The login failed. Login failed for user 'DOMAIN\ACCOUNT'.
If you’ve not used the Farm Configuration Wizzard the service accounts you’re using for the Web App Service Applications might not be provisioned correctly and have not the neccessary rights to connect to the content database.
Grant at least read/write permissions to the service application account at the corresponding content database.
PS: There might be an PowerShell CmdLet for this operation – this post will get updated if i have found a better solution.
As promised – the PowerShell Script:
$w = Get-SPWebApplication -identity http://URL $w.GrantAccessToProcessIdentity("DOMAIN\SERVICEAPP")