Re: Simple SQL Security Question From SQL Newbie

From: Scott Gravenhorst (no.spam_at_gte.net)
Date: 10/22/03


Date: Wed, 22 Oct 2003 20:08:27 GMT

Thanks much for the response.

On Wed, 22 Oct 2003 20:43:33 +0100, "Jasper Smith"
<jasper_smith9@hotmail.com> wrote:

>If the error is still the login failed message then make sure you used
>sp_grantlogin (not sp_addlogin) e.g.
>
>exec sp_grantlogin 'WIN2K\ASPNET'
>go
>use <your_db_name>
>exec sp_grantdbaccess 'WIN2K\ASPNET'
>go
>grant ALL on y2003 to [WIN2K\ASPNET]

I did exactly this as you suggest (except that the grant all had to be
in upper case for some reason), all of these seemed to work (no error
messages), yet the error message persists (and is the same 'login
fails' message).

Frustating to say the least.

>
>--
>HTH
>
>Jasper Smith (SQL Server MVP)
>
>I support PASS - the definitive, global
>community for SQL Server professionals -
>http://www.sqlpass.org
>
>"Scott Gravenhorst" <no.spam@gte.net> wrote in message
>news:3f96d8a6.12061323@news.microsoft.com...
>Please take pity on an SQL newbie...
>
>Window 2000 Pro
>MSDE
>VS.NET 7
>
>As Administrator, using OSQL, I created a simple database with one
>table. I can INSERT rows and do SELECT commands with OSQL. Inside
>VS.NET, I can use the server explorer and I can see the database, it's
>tables and I can view records. I've written a simple .aspx to display
>the data, but when it's executed, it returns this error:
>
>System.Data.SqlClient.SqlException: Cannot open database requested in
>login 'WebCalendar'. Login fails. Login failed for user
>'WIN2K\ASPNET'.
>
>I understand that OSQL is the only tool available for managing
>security when using MSDE. I've tried using sp_adduser and sp_addlogin
>and sp_grantdbaccess with ASPNET, which all appear to work, but the
>.aspx error persists. I also did a GRANT ALL on y2003 TO ASPNET
>(y2003 is the table name). All of the databases supplied with the SDK
>work as expected from .aspx files.
>
>What the heck do I need to do to grant (full) access to this database?
>It lives on a LAN where I am the only user.
>
>Thanks in advance.
>
>



Relevant Pages

  • Re: No db access after publishing web site
    ... GRANT UPDATE TO ... If I detach and attach this database on a different PC (according that PC ... Cannot open database "pago" requested by the login. ... Are you detaching/attaching the SQL Server Express database correctly ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Permission to Insert records for DB USERS
    ... To add to the response by Vyas, consider creating your own database ... EXEC sp_addrole 'Supervisors' ... GRANT SELECT ON MyTable TO Supervisors ... > I am a fresh developer for the SQL server and have no Idea> for the permissions on the database. ...
    (microsoft.public.sqlserver.security)
  • Re: Complete Neophyte Question(s)
    ... No you cannot remove a login from the 'public' role. ... For rights to _use_ objects then the appropriate rights need to be granted ... GRANT SELECT ON dbo.Orders TO OrderViewers ... for a database that is supposed to be secured it is a bad idea ...
    (microsoft.public.sqlserver.security)
  • Re: Import Logins from text or spreadsheet
    ... set psw to generic value ... add user to database ... EXEC sp_addrolemember 'SomeRole', 'SomeLogin' ... Let's assume your Excel spreadsheet has 3 columns: Login, ...
    (microsoft.public.sqlserver.server)
  • Re: Import Logins from text or spreadsheet
    ... Good suggestion, Steve. ... EXEC sp_addlogin $, $, $(Database) ... EXEC sp_addrolemember $, $(Login) ...
    (microsoft.public.sqlserver.server)