Sql – ADO.NET SQL Client Provider default database connection

ado.netentity-frameworknetsql server

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

Best Answer

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.