Reputation: 6878
Does the .NET SQL Client DataProvider always connect using the master database. I've noticed that when I connect to the database to execute an ADO.NET query and then look at the active connections in SQL Management studio, the SPID for the .NET SQL client provider always uses master DB
The initial catalog in my connection string is that of the DB I'm connection to (and this is not master)
"select SPID,DB_NAME(dbid),program_name from sys.sysprocesses where program_name like '%.Net%'"
Here is the Output: alt text http://www.freeimagehosting.net/uploads/1046babbc1.jpg
Upvotes: 0
Views: 1413
Reputation: 238186
SQL Server has a per-user setting for the default database. Right after logon, you'll be in that database, and you'll need rights on that database to be able to logon.
The connection string "Initial Catalog" setting is only applied some time after logon.
Upvotes: 1