|
-
Dec 15th, 2005, 07:15 AM
#1
Thread Starter
Addicted Member
SQL Server 2000/ AD/ Trused Connection problem
Hi,
I have a Windows Application, a Novell Network and a SQL Server 2000 on an Active Directory controlled server. My AD account has access to teh database. I want to login to the database using an Active Directory account, trusted security....but I can't.
Sequence of Events:
1. Login to Network using Novell account.
2. Start Application and it displays login screen.
3. Enter AD account details and press OK
4. This verifies against Active Directory Account using the following code:
VB Code:
Public Function Login() As String
' now create the directory entry to establish connection
Dim deDirEntry As New DirectoryEntry(Me.strDomain, Me.strUser, Me.strPass, Me.atAuthentType)
Try
' if user is verified then it will welcome then
Try
Return deDirEntry.Username
Catch exp As Exception
Return ""
End Try
Finally
'deDirEntry.Dispose()
End Try
End Function 'Login
This all works fine and returns the username if the credentials match
5. Make database connection string (sUserName is the AD username):
VB Code:
Dim sConnstring As String = "User ID=" & sUserName & ";Initial Catalog=VendorSample;Data Source=MyServer...;Timeout=20;Trusted_Connection=True"
6. I get the following error:
Login failed for user '(null)'. Reason: Not associated witha trusted SQl Server connection.
I'm not well up on how AD works etc. but does anybody have any idea how to get past this?
-
Dec 15th, 2005, 07:58 AM
#2
Re: SQL Server 2000/ AD/ Trused Connection problem
Is the SQL SERVER box setup for WINDOWS or SQL AUTHENTICATION.
You should be able to see that in the PROPERTIES of the SERVER.
Seems to me that you are trying to connect with SQL AUTHENTICATION (passing a username a password in the connection string) vs. WINDOWS AUTHENTICATION (where you do not give a username or password in the connection string).
WINDOWS AUTHENTICATION is preferred - as the "credentials" to attach to the database are gathered from the username/pw the user entered to initially boot the workstation.
Additional credentials can be loaded in the control panel - if using XP PRO - see the link in my signature if that has anything to do with your issue.
-
Dec 15th, 2005, 08:48 AM
#3
Thread Starter
Addicted Member
Re: SQL Server 2000/ AD/ Trused Connection problem
Yes, the SQL Server is set up for Windows Authentication. Whether or not I pass a username, I get the same error message. The reason I was passing my AD username is that my windows and AD usernames are different
-
Dec 15th, 2005, 08:53 AM
#4
Re: SQL Server 2000/ AD/ Trused Connection problem
 Originally Posted by dec_obrien
Yes, the SQL Server is set up for Windows Authentication. Whether or not I pass a username, I get the same error message. The reason I was passing my AD username is that my windows and AD usernames are different
Then you cannot pass the username and password in the connection string - that is only for SQL authentication.
Search the forum for SSPI or INTEGRATED SECURITY - you will find examples of connection strings for WINDOWS AUTHENICATION.
-
Dec 15th, 2005, 09:49 AM
#5
Thread Starter
Addicted Member
Re: SQL Server 2000/ AD/ Trused Connection problem
But how do I get the Connection String to use the credentials of the Active Directory account?
My Windows account does not have permissions on the database (this is the account I use to log initially boot my workstation). When I login to my app, I create an Active Directory directory entry using:
Dim deDirEntry As New DirectoryEntry(Me.strDomain, Me.strUser, Me.strPass, Me.atAuthentType)
where:
strDomain is the domain; strUser is the username; strPass is the password; atAuthentType = false to not use SSL
After this, it try to make the connection. If I simply use:
"Initial Catalog=VendorSample;Data Source=MyServer...;Timeout=20;Integrated Security = SSPI" as the connection string, I get the error.
This is driving me crazy and any help is greatly appreciated...
-
Dec 15th, 2005, 09:53 AM
#6
Re: SQL Server 2000/ AD/ Trused Connection problem
If you are using WINDOWS XP PROFESSIONAL then there is a link in my signature about getting around LOGIN USER NULL issues.
-
Dec 15th, 2005, 11:51 AM
#7
Thread Starter
Addicted Member
Re: SQL Server 2000/ AD/ Trused Connection problem
I had a go at that on my PC and it didn't work. Did you mean to do that on the server?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|