I have been asked to maintain a site created in ASP classic that uses a SQL Server database.
I was given the database in the form of a backup. I restored the database on my local computer and created a DSN connection
to it. However when I attempt to load my site, the stored procedures
the site relies on give an error that execute permission was denied.
The stored procedures in question have a user named UserSecure
showing as the only person with EXECUTE
permission, I have tried creating a user by that name but that does not work, even though I can manually login to SQL Server Management Studio using UserSecure
trying to connect from the web page using those credentials gives a login failed error
.
If I run sp_helplogins
my Windows credentials are shown as being owner of the database, and I can in fact execute from within SSMS but not from an ADO connection.
On another note the connection in the webpage
was coded like this, I am not familiar with the application part of the connection. Perhaps this is part of the problem? I have tried connecting with a DSN
and DSN-less
connection and can connect but not do anything with the database?
You should make sure the database server login is mapped to the appropriate database user (this problem crops up often when dealing with database backups). If it is not, then you need to fix the mapping. Fortunately, there is a command called sp_change_users_login
that you can use to fix this problem.
First, check if your login is mapped to your database user. Using SQL Server Management Studio (assuming SQL Server 2008), look under Security/Logins for UserSecure
. If you see it in the list, double click on it and select User Mapping
. From there, locate the database you are trying to connect to, and see if UserSecure
is mapped to that database. If it is not, you may be able to fix it using the following command (assuming UserSecure
is the name of both the login and the user):
EXEC sp_change_users_login AUTO_FIX, UserSecure
See MSDN for more info on sp_change_users_login
:
http://msdn.microsoft.com/en-us/library/ms174378.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With