473,700 Members | 2,500 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL Connection String using Domain Account


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=Passw ord;User
ID=Domain\userI D;Data Source=ServerNa me\ServerInstan ce;Initial
Catalog=Databas eName;");

And

SqlConnection sqlCON = new
SqlConnection(@ "Server=ServerN ame\ServerInsta nce;Database=Da baseName;UID=Do main\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
Mar 2 '06 #1
4 41065
I think in order to connect as a domain account, your program has to be
running as that domain account user. And then you would use integrated
security to pass those credentials on to sql server.

Or, you can have a username/password set up in sql server - but this would
not be associated with any user accounts. It would just be using up a user
in that sql server. Then you would pass those credentials in the connection
string.

You are sort of trying to combine these 2 together, and that just doesn't
work.

"Tim Sapp" <Ti******@Spaml essCrossmark.Co m> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..

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=Passw ord;User
ID=Domain\userI D;Data Source=ServerNa me\ServerInstan ce;Initial
Catalog=Databas eName;");

And

SqlConnection sqlCON = new
SqlConnection(@ "Server=ServerN ame\ServerInsta nce;Database=Da baseName;UID=Do main\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

Mar 2 '06 #2


Yes I am starting to see that... I have added the Impersonate tag to my
Web.Config but now have the problem that the web site will not run under
that user ID. I have added it to the Administrators group on my dev machine
but I guess I am missing something else.
Tim
"Marina Levit [MVP]" <so*****@nospam .com> wrote in message
news:OA******** ******@TK2MSFTN GP14.phx.gbl...
I think in order to connect as a domain account, your program has to be
running as that domain account user. And then you would use integrated
security to pass those credentials on to sql server.

Or, you can have a username/password set up in sql server - but this would
not be associated with any user accounts. It would just be using up a user
in that sql server. Then you would pass those credentials in the
connection string.

You are sort of trying to combine these 2 together, and that just doesn't
work.

"Tim Sapp" <Ti******@Spaml essCrossmark.Co m> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..

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=Passw ord;User
ID=Domain\userI D;Data Source=ServerNa me\ServerInstan ce;Initial
Catalog=Databas eName;");

And

SqlConnection sqlCON = new
SqlConnection(@ "Server=ServerN ame\ServerInsta nce;Database=Da baseName;UID=Do main\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


Mar 2 '06 #3

"Tim Sapp" <Ti******@Spaml essCrossmark.Co m> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
|
| 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=Passw ord;User
| ID=Domain\userI D;Data Source=ServerNa me\ServerInstan ce;Initial
| Catalog=Databas eName;");
|
| And
|
| SqlConnection sqlCON = new
|
SqlConnection(@ "Server=ServerN ame\ServerInsta nce;Database=Da baseName;UID=Do main\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\domain Account] FROM WINDOWS WITH
DEFAULT_DATABAS E=MyDB;

Willy.


Mar 2 '06 #4
SqlConnection sqlCON = new SqlConnection(@ "Password=Passw ord;User
ID=Domain\userI D;Data Source=ServerNa me\\ServerInsta nce; Initial
Catalog=Databas eName;");

Above is your connection string with one change in the data source,
after server name add another "\". I am not quite sure why, but with
our web application last night this was an issue once again.

On some servers we can use simply:

Data Source=ServerNa me\ServerInstan ce

On others we will not be able to connect until we:

Data Source=ServerNa me\\ServerInsta nce

I am actually researching this right now and ran across this thread and
I hope that you figured out what the problem was already, but if not
this might help you.

Mar 23 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3500
by: Gram | last post by:
Hello, Can anyone point me to a connection string for ASP to connect to an MS Access database using a username and password? Thanks in advance. Gram
2
4623
by: Maziar Aflatoun | last post by:
Hi guys, I'm using Windows authentication to connect to SQL Server 2000. On my computer the connection is fine. Now if I move it to a remote server, how to I hard code my Username/Password in my connection string (using Windows NT authentication and not SQL Server authentication)? Thank you Maz.
0
1138
by: Scott Rosa | last post by:
We are looking at changing our connection strings to SQL server to use integrated security. We would use connection pools in IIS6 and authentication of the aspnet user against AD to control access to SQL Servers...see the last paragraph in this artice... http://idunno.org/dotNet/trustedConnections.aspx. This article refrers to possible performance impacts of this method. Can anyone comment on this.
39
2894
by: sucaba.r | last post by:
I don't know if this is a unique problem, or I'm going about it the wrong way. I currently connect to one of our SQL servers via a priviliged account (by using RUNAS). Works with no problem. I now need the ability to connect to the same SQL server using ASP. I have the following connect string, but I'm not sure how to specify the domain in the string, or is there some other way? <% Set demoConn =...
2
7428
by: mattheus0525 | last post by:
Hi. I am asked to connect to SQL server to retrieve a record from its table from MS Access directly. Given the following lines of code, I am not able to connect to the SQL server because the login id used is a domain account not sql server login id . Private Sub Command0_Click() Dim lobjCn As New ADODB.Connection
0
8645
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9214
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9075
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8973
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8925
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6561
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4404
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2392
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2028
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.