0

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

2
  • Have you tried running profiler to see if any statements are executed on the master DB? Commented Apr 3, 2009 at 7:30
  • I did but did not notice anything out of the ordinary Commented Apr 4, 2009 at 5:53

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Looks that this is exaclty what was going on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.