Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This operation requires a connection to the 'master' database

I have suddenly started getting an error in my application.

The error is:

This operation requires a connection to the 'master' database. Unable to create a connection to the 'master' database because the original database connection has been opened and credentials have been removed from the connection string. Supply an unopened connection.

Nothing has changed in the code - and database access is fine throughout the rest of the code.

It stops on this line:

var filteredContacts = dc.EAContactLists.Where(o => teams.Contains(o.Team)).ToList(); 

I am lost on this one.

like image 585
Mark Avatar asked Nov 14 '13 12:11

Mark


People also ask

What is master database file?

The Master database is the primary configuration database in SQL Server. It contains information on all the databases that exist on the server, including the physical database files and their locations. The Master database also contains SQL Server's configuration settings and login account information.

Can I drop master database?

You can do this with SSMS . If you browse to the tables overview in the object browser and then select the object browser detail pane, you can sort on e.g. table create date and select all the tables you want to drop. check the checkbox "continue on error" and then hit your delete button.

What is master SQL?

The master database records all the system-level information for a SQL Server system. This includes instance-wide metadata such as logon accounts, endpoints, linked servers, and system configuration settings.


2 Answers

Try setting Persist Security Info = True in your connection string.

Hope this helps.

like image 122
Shashank Chaturvedi Avatar answered Sep 19 '22 06:09

Shashank Chaturvedi


I had this issue and in my case resolved it by adding "Integrated Security=True" to the connection string. This only applies if you're connecting to the DB using Windows Authentication. Hope it helps.

like image 27
Steve Terry Avatar answered Sep 21 '22 06:09

Steve Terry