Sunday, March 11, 2012

Access to SQL Server via WCF works only part time

We have 2 databases ( Guider and Talker ) and we have a WCF service that is logged in with a domain identity.

In our SQL Server we have the service ID added to the Data Server Logins and both Guider and Talker are given access to the user.

When we access Guider we have no problems getting data.

When we access Talker we have a login failure:

Cannot open database 'Talker' requested by the login. The login failed.

Login failed for user 'Acorn\CommunicationServices'.

The thing that gets me is that the user is created at the Server level, in both Databases, and at the server level both databases are checked for the user. master has been set as the default database for the user.

Basically, as far as I can see Talker and Guider are configured identically! So I cannot figure out why I cannot login to the second database!

Is there a specific setting I'm missing somewhere to grant login access to the user? I'm using

Management Studio Express to manage the database.

My guess here is that the default database defined for the login that fails (Acorn\CommunicationServices) is not configured properly. Another possibility may be a typo when specifying the DB name in the client.

One test you can try to verify if the principal can really access the DB is:

*Connect as a sysadmin

* run “EXECUTE AS LOGIN = ‘login_name’ “ to impersonate the principal

* USE [Talker]

I hope this helps,

-Raul Garcia

SDE/T

SQL Server Engine

No comments:

Post a Comment