Re: SQL Connection String using Domain Account




"Tim Sapp" <Tim.Sapp@xxxxxxxxxxxxxxxxxxxxx> wrote in message
news:%230JR87gPGHA.3100@xxxxxxxxxxxxxxxxxxxxxxx
|
| Folks,
|
| I am working on a .Net web site that connects to SQL Server 2000 on
another
| box. The DBA has given me a Domain user account with rights to the
database
| and table. I have confirmed with Query Analyzer that the user ID and
| password are good and can access the correct tables. However, I am
unable
| to get a connection to the database. I either get a Login Failed for
(NULL)
| user. or Not a Trusted Connection, or Login failed for userID. I have a
| felling that I am just using the wrong connection string but each one that
I
| have tried still fails. The end user must login to the site and it set up
| as integrated, but I am not able to use the users ID since they do not
have
| access to the database.
|
|
| Here is what I have tried so far.
|
| SqlConnection sqlCON = new SqlConnection(@"Password=Password;User
| ID=Domain\userID;Data Source=ServerName\ServerInstance;Initial
| Catalog=DatabaseName;");
|
| And
|
| SqlConnection sqlCON = new
|
SqlConnection(@"Server=ServerName\ServerInstance;Database=DabaseName;UID=Domain\UserID;PWD=Password");
|
| I have tried it with and without the domain name. Most of the time I just
| get the standard "Login Failed for Domain\UserID" so it appears to be
| getting to the server and rejected. I have a feeling that it is treating
it
| as a standard SQL account and not a domain account.
|
| Anyone know what I am doing wrong?
|
|
| Tim

You can map a domain account to a SQL login, see CREATE LOGIN in SQL books
on line.
For instance, following command creates an SQL login that maps to a domain
account
CREATE LOGIN [mydomain\domainAccount] FROM WINDOWS WITH
DEFAULT_DATABASE=MyDB;

Willy.








.



Relevant Pages

  • Re: Please! Doesnt anyone know a better way to do this?
    ... account, they need to automatically be directed to the page to enter data ... session variable on the Account page. ... I assume here that you're checking a database when the user attempts to ... When a new user attempts to login or clicks to register, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Security controls in a web application
    ... one may be better off passing account management tasks ... to the operating system or database server ... I'm afraid that my web app is lacking of many security controls. ... I have implemented some security controls like a login page that asks ...
    (microsoft.public.security)
  • Re: sp_addrolemember with Windows SQL Server Login
    ... error as long as a valid domain account was specified. ... SQL Server apparently allows you to add a Windows account to a database ... he noticed that User1 was a NT Login ...
    (microsoft.public.sqlserver.security)
  • Re: RESTORING CRASHED SITE WEBS
    ... Well, when installing Sharepoint, the installer did display a message ... I can't login using any existing accounts. ... >> access using Windows Security the account returned in the failed ... I put in the database server name and ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: creating a user and then adding the user to a role
    ... sp_grantlogin (allow NT account to connect to sqlserver) ... At database level - once an user can connect to the ... Use sp_adduser (for sql login) or sp_grantdbaccess (for NT ...
    (microsoft.public.sqlserver.programming)