Reputation: 21
I am trying to write a web service to update an online database and will be subsequently writing a website to access the data, but am having problems with my SQL Server login permissions.
I want to access the database using Entity Framework, the connection will use SQL Server authentification. I want the login to only have execute permissions on stored procedures to be able to reduce any security threat - however whenever I try and add a new connection to the database it won't allow me to do so and the only way I can add the connection is if the login has a dbcreator role.
I get the following error coming up -
CREATE DATABASE permission denied in database 'master' An attempt to attach an auto-named database......A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
If the connection is forced to use a login that has a dbcreator role it seems a big security risk, not so much for the webservice as the login will be password protected but the website will store the password in the code so could possibly be compromised and used to make changes.
I'm sure there is a good solution - I'm just having trouble tracking it down. Most of the solutions seem to be to give the connection the dbcreator role.
Upvotes: 2
Views: 694
Reputation: 1160
Entity Framework by default wants to create the database. You can change that : https://stackoverflow.com/a/5018062/384701
Upvotes: 2