Some errors never got old. I have seen many new DBA or Developers struggling with this errors.
Error: 18452 Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection.
Fix/Solution/Workaround:
Change the Authentication Mode of the SQL server from “Windows Authentication Mode (Windows Authentication)”
to “Mixed Mode (Windows Authentication and SQL Server Authentication)”.
Run following script in SQL Analyzer to change the authentication
LOGIN sa ENABLE
GO
ALTER LOGIN sa WITH PASSWORD = '<password>'
GO
OR
In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties. On the General page, you may have to create and confirm a password for the sa login. On the Status page, in the Login section, click Enabled, and then click OK.
Reference : Pinal Dave (http://blog.SQLAuthority.com) , BOL




Your article really helped me – I forgot my ’sa’ password and your script helped me change it.
Thanks Again!
Hi,
Your article really helped me. I really appreciated that.
Thanks,
Manoj
I am getting this error when try connecting with SQL server 2000 using Query Analuzer on XP machine.
Server: Msg 18452, Level 16, State 1
[Microsoft][ODBC Server Driver][SQL Srver]Login failed for user ‘(null)’. Reason: Not associated with a trusted SQL Server connection.
Your artical really help me, when I am trying this in the production. Because I wrongly selected Authentication Mode of the SQL server from “Windows Authentication Mode (Windows Authentication)” with the help of your script I have change to “Mixed Mode (Windows Authentication and SQL Server Authentication)”, its work out…
Hi,
why should I change the authentication??
Actually, I am trying to run a query thru linked server. I linked the server by windows login and my target SQL server is running under windows authentication only and I am getting the same error.
Please clear my doubt why should we use only mixed mode? Why it is not working with windows authentication, even I am using a domain account to connect?
Rizwan,
There should not be any need to change the authentication in theory. However, this error is quite generic and this way it can be fixed first and then you can work backwards towards your original configuration and see what is the issue.
Regards,
Pinal Dave (SQLAuthority.com)
I am using linked server and getting same error when trying to access linked server. I have Server1 with linked Server2. I am connected to Server1 using management studio remotely and trying to access linked server Server2. If I connect locally to Server1 and try to access linked Server2 this works. Any help will be appreciated.
Hi,
Things were working quite happily locally on my machine with Windows Authentication .. I tried setting up an ODBC connection to the database; this did not work
Upon trying to reaccess the database, via SQL Server Management Studio, the system reported, “Login failed for user . The user is not associated with a trusted SQL Server connection”
Luckily I was able to connect using 127.0.0.1 rather than my machines DNS name and was able to create the sa account to regain access. How is it then that I re-enable Windows Authentication mode?
Thanks
mrplatypus ..
This is for WINDOWS AUTHENTICATION:
I received this error when connecting to the SQL Server remotely via my application. After researching, I found that you had to both enable trusted authentication on my SQL Server machine and grant the User Right “Enable computer and user accounts to be trusted for delegation” (Group Policy…under Local Policies\User Rights Assignment) to the Windows account you are using. I just granted it for the Administrators group.
For the SQL Server machine, I set the property in Active Directory (check the box labeled “Trust computer for delegation” in the computer’s properties).
Make sure you for the group policy changes (gpupdate /force).
I have clustered SQL 2005 Enterprise 64 bit and SQL 2005 SP2 on a Windows 2003 server and I can log in fine with domain credentials, but not with ’sa’. SQL is installed in mixed auth mode and has all the default protocols, including Named Pipes and TCP/IP. I get error 18452 and I have read many, but not found any articles or discussions on the Internet or from Microsoft that solves the problem. My head hurts.
Any help is appreciated.
I’m trying to switch from windows authentification mode to sql server authentification.
Have doen all as you’ve written.
and it still gives me error Error 18452 (not associated with a trusted sql server connection)
Frank Stevens, could you be more specific, where to change theese policies and other things form you post.
Are there any problem if the server is on different network than client?
In my scenario my client is working into a network without Windows servers (so any AD is running or required for validation) but the SQL server (that is an SQL server 2000 SP3 running on a Windows 2003 server R2) is into another network WITH AD.
The connection is transparent through router. All other network services runs fine between both networks.
I’ve followed all steps but I’m still having the same problem.
2 clients running same OS with same ODBC have different behaviors. The client connected on same server’s network runs fine but the other one raises this error.
Any help will be appreciated
Please check the Server name is in Sink with server name of SQL Server. The host name should be the same as
Select @@Servername. If they are not the same, then use SP_Dropserver ‘oldServername’ and then Supply SP_addserver ‘Servername’,'Local’. then restart the server (OS) to take effect.
sql express05 does allow me change password when
iam logged with windows authentification,on next restart doesnt allow me to login with sa(by the way it shows some long password with asterixs).meaning it is not changing the password and
reports below error.this is LOG
TITLE: Connect to Server
——————————
Cannot connect to BLEEDING-DESKTO\SQLEXPRESS.
——————————
ADDITIONAL INFORMATION:
Login failed for user ’sa’. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)
—————–
any way to change to mixed mode authentification?
This is nice work around .
It helped me ‘N’ times .. i did it several times on several times ..for got the solution referred this article and got back to work and implemented it .
Thanks
Ravi Srinivas
Hi,
I fogtot to create sa authentication mode at the time of installation. How to create sa authentication. Is it possible at this time. I am able to access windows authentication only. Pl
I have an ASP.NET 2.0 Application on machine A. I am using forms authentication with Active Directory. My SQL 2K database is on machine B. On machine A, I can access my application, with no problem. When i try to access the application over the network from different machines, i get this error.
Server Error in ‘/EXACT-WHRM’ Application.
——————————————————————————–
Login failed for user ’sa’. Reason: Not associated with a trusted SQL Server connection.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user ’sa’. Reason: Not associated with a trusted SQL Server connection.
======================================
please help. am at my wits end.
moseti
I discovered that I had to restart the Sql Server service on my local machine to allow sql server authentication to work.
thank u very much for your article…
it really helping me
I am finding the issue while try to connect/create database in SQL Server 2005 from different application.
Login failed for user ’’. Reason: Not associated with a trusted SQL Server connection.
I tried with the above mentioned but it is failing to connect.
Pointers please.
Regards,
Dev
Hello,
i am using sql server 2005 and installed in mixed mode withe user name sa and password #sa
and from Sql Server Surface Area Configuration i select the Using both TCP/IP and named pipes for remote settings under Database Engine
version is [@@version]
Microsoft SQL Server 2005 – 9.00.1399.06 (Intel X86) Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Evaluation Edition on Windows NT 5.1 (Build 2600: Service Pack 2)
My os is Xp with service pack2
I am using asp.net 2.0 and using connection string in web.config
SOURAV is my local Database Server name.
I can connect server with the user name password from the SQL Server Management Studio,
But the problem arise when i hit con.open() from asp.net page
error message show login failed for user ’sa’
Please help how to solve,
Thanks in advance
Sourav
the sql server registertration failed user and the two user in different operating system but in the same network group
I have the same problem, but in my case, changing to Mixed Mode authentication did not fix the problem.
I can login under Windows Authentication without problem, but any attempt to use SQL Server Authentication results in the “not associated” error.
I have also tried using the “sa” account, changing “sa” passwords, and even dropping password policy on the “sa” account… no joy. I have also tried creating new users, with explicit server authentication permission and passwords, but still no luck.
Any suggestions?
hi
I am trying to configure log shipping on sql server2000 on a domain with a machine with same sql server 2000 on different domain but i m getting the error :
Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL Server ‘ANKUR-BZOPEK2PX’ as ‘ANKUR-BZOPEK2PX\sqladmin’ (trusted)
Starting maintenance plan ‘log_ship’ on 3/18/2008 10:20:00 AM
[1] Database log_ship: Transaction Log Backup…
Destination: [E:\backup\log_ship_bakup\log_ship_tlog_200803181020.TRN]
** Execution Time: 0 hrs, 0 mins, 1 secs **
[Microsoft SQL-DMO (ODBC SQLState: 28000)] Error 18452: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user ‘(null)’. Reason: Not associated with a trusted SQL Server connection.
[2] Database log_ship: Delete Old Backup Files…
0 file(s) deleted.
Deleting old text reports… 0 file(s) deleted.
End of maintenance plan ‘log_ship’ on 3/18/2008 10:20:00 AM
SQLMAINT.EXE Process Exit Code: 0 (Success)
please suggest me
thankyou
but still my problem persists,Error:18452;trusted connection
thanks it solves my problem.
may you have to chek in the propriete of the server on the consol management sql express the tab securité
Another thing to check is the information you add to your Add Connection box.
Make sure you have the correct path of the servername. You may need to do something like this: MYCORPSERVER/SQLEXPRESS
The wrong path will also give that ugly “Login failed…” error
hiiii
i have given the userid as “sa” itself…..and mode of authentication is mixed mode itself……but still i am getting the error…..”login failed for the user ’sa’ ” while connecting to sql server.
hai
thanx for ur help
The problem is usually the security tab in the link server.
use the correct connection setting.
I always recomend login maping and use the current login security context. hope this help. :-)
Really lots of Thanks for this solution.
I m facing this problem from long time and had no solution.
This is really working solution which works for me.
Thank you very much.
Post this kind of Fixes of error in future.
Hi,
Problem:
I am getting this error when try connecting with SQL server 2000 using Link Servers on XP machine.
Server: Msg 18452, [SQL Srver]Login failed. Reason: Not associated with a trusted SQL Server connection.
Solution:
Corect My DNS (Main Domain) and Change the Authentication Mode of the SQL server from “Windows Authentication Mode (Windows Authentication)”
to “Mixed Mode (Windows Authentication and SQL Server Authentication)”.
Thanks,
Mahesh.
Hi
Thank you for the solution. I tried many ways to change the authentication mode from Windows to Sql Server Authentication mode. But there is no use. But after trying the above, the problem solved immediately. Thank you for the code.
hi
I am using Vista as an OS. I am currently working on VS 2005 and SQL Server 2000. i am tired of working wiht this error and m really screwed up. can u please help??
Login failed for user ‘Anubhav-PC\Anubhav’.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException:
Login failed for user ‘Anubhav-PC\Anubhav’.
Source Error:
Line 48: cn = New SqlConnection(“data source=localhost;initial catalog=payroll;integrated security=sspi;”)
Line 49:
Line 50: cn.Open()
Line 51: eid = TextBox1.Text
Line 52: ename = TextBox5.Text
I have tried creating a new user named ‘anubhav’ and have changed mode to Mixed. Yet the problem persists.
Please help!!!!
Thanx in Advance
Anubhav
Hello sir,
I am getting following error when i m creating system dsn for sql server 2005.
I HAVE ASLO DONE THE AUTHENTICATION MODE FROM WINDOWS TO MIXED MODE.
Connection failed:
SQL state: ‘28000′
SQL server error:18452
[Microsoft][ODBC SQL server driver][SQL server] login failed for user ‘asdf’. User is not associated with a trusted SQL server connection.
Hi All
i am using SQL Server 2005 SP2 mixed mode of authentication is in use still getting this error
Login failed for user ”. The user is not associated with a trusted SQL Server connection
Error: 18452, Severity: 14, State: 1.
any help will be appreciated.
Regards
Hi,
This article is useful but because of some security requirements we have to use windows authentication only. So, i wanted to ask whether there is a possiblity to solve it by using the windows authentication mode.
Thanks.
Hi All,
Me also facing this kind of problem. I executed the following sql statement. But still I am getting ”
” Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword ‘user’. ”
while runing this SQL statement. Please forgive me for this silly qstn. I am a new boy to this SQL Server world.
SQL Statement I executed :
ALTER LOGIN user ENABLE
GO
Thanks
Arun J
I have SQL SERVER 2005 (EXPRESS) running on my home desktop machine. However, on this desktop machine there is no Query Analyzer and neither SQL Server Management Studio. It’s my first time to use SQL Server 2005.
On my office laptop, I have SQL Server Management Studio. When I try to connect to the SQL server on my desktop machine, I get this error.
Error: 18452 Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection.
Here is a screenshot of the error I am getting.
http://i303.photobucket.com/albums/nn134/s1mpl3k1d/sql_loginerror.gif
Any help would be greatly appreciated.
I don’t know if my error is the same as everyone else:
Access 2003 on a Windows Vista Pro PC. Everyone else can access the Access program on their PC but they have Windows xp. I have admin rights.
Since the user switched to Windows Vista Pro from XP, he gets Microsoft SQL Server Login error:
Connection failed
SQLState’28000′
SQL Server Error 18452
[Microsoft][ODBC SQL Server Driver][SQL Servr] login failed for user (null). Reason Not asscociated with a trusted SQL Servr Connection.
He was able to use the Access program before. I did set up the ODBC connection as I always do on everyone else’s pc.
I also tried to log into the sql server at the prompt with my userid and password as I have admin rights, but I still get the error. I also tried the administrator logon id / pw and still get the error.
Why can’t he use the Access database on Vista Pro? Is there something I need to download? Is there something I need to update from Microsoft?
Thanks in advance for any help.
Sorry, I didnt mention the version of SQL Server we have : 2000
OK just to update. I didn’t know that the user was not logging into the domain. The user was setup by our IT person to log into the local laptop for some reason.
Once the user logs into the domain it worked.
:D
Hi All,
while reinstalling the SQL server getting an error like all the components are already installed but there is no components are showing let any one give a solution for this problem.
To change security authentication mode
1.
In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
2.
On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
3.
In the SQL Server Management Studio dialog box, click OK, to acknowledge the need to restart SQL Server.
Ref: http://technet.microsoft.com/en-us/library/ms188670.aspx
Dim linkTable As TableDef
Set linkTable = CurrentDb.CreateTableDef(tableName, dbAttachSavePWD)
linkTable.Connect = “ODBC;Driver={SQL Server};Server=SERVERNAME;” _
& “Database=DATABASENAME;Uid=USERNAME;Pwd=PASSWORD;”
linkTable.SourceTableName = tableName
CurrentDb.TableDefs.Append linkTable
Hello Sir ,
This article was really helpful .
But I am not able to connect to database from VB.Net using Windows Authentication . I am able to do it using “sa” account . Meanwhile I am also able to get in Sql Management Studio using local as well as sa account .
Mixed Mode Authentication Used
In the below code if i change UserId to sa then my task is accomplished .
Am I missing Something?????????
Code Used :
Sub Main()
Try
Dim cbs As New SqlConnectionStringBuilder()
cbs.DataSource = “Franklin”
cbs.Add(“Initial Catalog”, “Sharepoint”)
cbs(“Integrated Security”) = False
cbs.UserID = “Francis”
cbs.Password = “”
Dim conn As New SqlConnection(cbs.ConnectionString)
Console.WriteLine(“Opening Connection”)
conn.Open()
Console.WriteLine(“Connection Opened”)
Console.WriteLine(“Closing Connection”)
conn.Close()
Console.WriteLine(“Connection Closed”)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
Console.ReadLine()
End Sub
SQLServer running on Win2k3. Ran sysprep to generate a new SID in attempt to fix blue-screen problem with domain authentication (another story…).
Anyway, since generating the new SID, Windows authentication to SQL Server is broken. The sa account is disabled. I can log in with a read-only SQL user and that is all I can do. The agent won’t start – fails to authenticate as Local System.
I need to re-initialize SQL security so I can log in via Windows (Administrator). Or enable ’sa’ somehow. Any ideas?
I tried to create new users from security login and give the database which allow the user access, but the user could not login from application. I do not know why?
Ting
I have developed ASP.net 2005 website. It has connectin with SQL server 2000 SP4. Whwn I run the site from VS 2005, it runs perfactly. But when I upload it on the IIS server (OS Win2000), the SQL server is not getting connected the error is… Not associated with trusted SQL Server connection.
I have tried will all following options :
1. Changed the authentication mode to SQL Server and Windows mode with audit option None.
2. Included Integrated security=SSPI in connection string
3. Included Trusted_Connection=True in connection string
4. Tried with user name and password in connection string
5. Created a new user and assigned dbo.owner permission to the user and provided user id and password in conncetion string.
Still the error persists.
Can anyone help me ???
thank you very much
this article really help me
Hello,
I have an Access 2003 DB with an ODBC connection to a SQL 2000 Server. There are about 4 different people with similar security rights who use this and 3 are able to use the db with no problem.
One person has the same error as described on this page
Error: 18452 Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection.
This user claims that he usually does not log into the domain but he claims that in this case he was logged in and it still did not work. I submitted a ticket to IT to take a look at his account and they verified that he has admin rights to his PC.
Do you know why one person would have this error when others with the same security rights do not have problems? Would this indicate a domain issue perhaps?
Thanks,
Creed
Scenario: You are using SQL Server 2005/2008 management studio to connect to a SQL Server. In management studio, you are trying to set up a linked server. When trying to access the linked server, you receive the error message in this plog.
Problem: Because you are remotely connected to your SQL Server and trying to access a linked server, you are engaged in a double-hop authentication. IE, your credentials are passed to your SQL Server and your SQL server is trying to pass them to the linked server. This requires Kereberos authentication.
Solution: A domain admin must enabled delegation of your SQL server via Active Directory so your credentials can be passed through.
i have installed SQL SErver 2000, when i try connect using ‘SQL server authentication’ mode with ‘SA’ or my username, it is giving me 18452 – user not assoiciated with a trusted connection. i noticed ‘Mixed authentication’ mode set to disabled. how should i fix this issue?
Does anyone know what might cause this error to occur sporadically? I have a service which makes a connection every few minutes to several servers. If the connection fails, I get paged. Once it’s able to connect, I get paged again. This error is occurring randomly on a few of the servers; the service is able to reconnect after a few minutes. So I’ve had many sleepless nights lately!
Hi Sue,
I am having similar issues where my application would occassionally lose connection to SQL Server. After a few mins, the connection would be restored automatically but it is definitely cauing problems in the production environment.
My SQL is clustered but no failover occurred when the connection was lost.
Anyone can help? Much appreciated.
SQL Log says:
Error: 17806, Severity: 20, State: 2.
2008-11-03 07:54:25.63 Logon SSPI handshake failed with error code 0×80090311 while establishing a connection with integrated security; the connection has been closed. [CLIENT: 10.1.64.44]
2008-11-03 07:54:25.63 Logon Error: 17806, Severity: 20, State: 2.
2008-11-03 07:54:25.63 Logon SSPI handshake failed with error code 0×80090311 while establishing a connection with integrated security; the connection has been closed. [CLIENT: 10.1.64.41]
I am try to use the following script to open some linked tables from an SQL 2005 Server from a client with Access 2003. I can do it manually with no problem, but when running the script I get the following error.
Could not find installable ISAM
Can Anyone Help Me Please?
Option Compare Database
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Call LinkToSQL(“dbo_Batch”, “Riegos”, “dbo_Batch”, “AAA”, “sa”, “INFO121″)
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
Sub LinkToSQL(strAccessTable, strDBName, strTableName, strDataSourceName, strUserID, strPassword)
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection
Set tbl = New ADOX.Table
tbl.Name = strAccessTable
Set tbl.ParentCatalog = cat
tbl.Properties(“Jet OLEDB:Create Link”) = True
tbl.Properties(“Jet OLEDB:Link Provider String”) = “OBBC” & _
“;Database=” & strDBName & _
“;UID=” & strUserID & _
“;PWD=” & strPassword & _
“;DSN=” & strDataSourceName
tbl.Properties(“Jet OLEDB:Remote Table Name”) = strTableName
cat.Tables.Append tbl
End Sub
I had this problem and was due to account being locked out.
To change security authentication mode
1.
In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
2.
On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
3.
In the SQL Server Management Studio dialog box, click OK, to acknowledge the need to restart SQL Server.
Thanks, solved the problem with ease.
I am trying to write a Maintenance Plan history to a remote server. Nothing shows up in the table, and the text log file has the following error.
[Microsoft SQL-DMO (ODBC SQLState: 28000)] Error 18452: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user ‘(null)’. Reason: Not associated with a trusted SQL Server connection.
I tried running the script at the top of this discussion and keep getting the following error.
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ‘LOGIN’.
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ‘LOGIN’.
I have checked the login settings in Security via Enterprise Manager, and have also confirmed I can log in using SA.
Any suggestions?
Hi,
Im using msql server 2000. My problem is i cannot connect to my server. I tried all my knowledge but it doesnt work
1. sql network interfaces, error: 26.
please help
Renato
I am still not able to connect, same error.
using sql server 2005 SP2.
I got this error once i had installed .NET Freamework 3.5, athen everything is messup.
can you help me out please?
Hi !!!
Just a simple and wonderful solution. I’m migrating an application on VB6, SQLServer2000 and Windows2000 to a new server (Win2003 Server) and I got this message. I didn’t believe the solution will work, but anyway I tried and it worked perfectly.
Thanks so much from Mexico.
Regards
Yan
Really helped!!
really a big thnx ,i spend 5 hours in it but when i read this it works :)
Hi
I need to connect my C# windows Form to a SqlServer IP which is in same LAN but remote. When I try to connect it says
“error 18452 The user is not associated with a trusted SQL Server connection”
This is the conn string i am using
string strSQLconnection = @”Data Source=107.2.2.10,2230;Initial Catalog=OrderPlacement;Integrated Security=True;User Id=xxx;Password=xxx;User Instance=True”;
Can you pls help?
Thanks
Mohit
Hi,
Is there any way that we can change this authentication mode from windows to mixed using Scripts?
In my case, I don’t want to use the SQLServer Management Console for this change. Because I am keeping everything (includind database creation, user creation, table creation etc) in scripts.
I appreciate your help on this.
Thanks,
Gopal
Hi,
I am using the MS SQL 2005(64Bit) on Windows 2003 64Bit. SQL Server is running on cluster. So time when I restart one of the domain controler , getting the following error. SQL Server has setup on mix mode and has given the correct DNS setting
An Error has occurred in Phoenix2, Version=1.0.3330.29344, Culture=neutral, PublicKeyToken=null
—————————————————————-
System.Data.SqlClient.SqlException: Login failed for user ”. The user is not associated with a trusted SQL Server connection.
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Phoenix2.mSKFunctions.LogError(LogSeverity Severity, String& Message, String& Details) in C:\Development\Phoenix\Phoenix\Phoenix\mSKFunctions.vb:line 1137
—————————————————————-
Appriciate your grate help on this.
Thanks
Ranjith
I just want to say thank you!
Regards!
Hi Gopal,
try this :
USE [master]
GO
EXEC xp_instance_regwrite N’HKEY_LOCAL_MACHINE’, N’Software\Microsoft\MSSQLServer\MSSQLServer’, N’LoginMode’, REG_DWORD, 2
GO
I have a problem with sql server 2005. I have created a web setup project using custom action to create database at installation time. Every thing is ok. It creates prerequisites (.net farmework 2.0, sqlserver 2005 express, etc.) and database successfully during installation. I have used the connection string
connectionString=”Data Source=.\SQLEXPRESS;Initial Catalog=TrainTrack;Integrated Security=true;” in my custom action which executes database script successfully and install web application as well.
But when i execute my application login page and supplies Login Id and Password, It did not connect to sql server on other machine. It works fine on my development machine fine also.
I check my application connection string in ‘Inetpub\wwwroot\Application\web.config, which is also the same as custom action connection string.
I do not understand, actually what’s problem is?
Any one please help me.
Thanks
Ranjith:
This knowledge base article talks specifically about a fix for login errors when the domain controller is restarted:
http://support.microsoft.com/kb/942636
Thank you!!! Pinal Dave….This article really helped a lot….
Its helpful. Thank u
I have my Server set to SQL Server and Windows Authentication Mode, but I get “Login filed for user ”.
My app settings are as follows:
In my web.config settings, I have the authentication mode defined within as follows:
I have been wrestling with this problem for over a week and still don’t have a solution. My problem seems similar to the others, but I already had the authentication mode set to both Windows and SQL Server.
Can you tell me what I need to do to correct my error?
Thank you very much,
Art
P.S. The error message with stack is as follows:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user ”.
Source Error:
Line 28: pw = Request.Form(“password”)
Line 29:
Line 30: If UserLogin(reg, pw) Then
Line 31: Response.Redirect(“MainMenu.aspx”)
Line 32: Else
Source File: C:\Users\Art\Documents\Visual Studio 2008\WebSites\WebSite1\Login.vb Line: 30
Stack Trace:
[SqlException (0x80131904): Login failed for user ''.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846887
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +144
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
PC.DbAccessor.GetDR(String cSQL) +127
PC.EDUPage.UserLogin(String aUserName, String aPassword) +176
Login.cmdLogin_Click(Object sender, EventArgs e) in C:\Users\Art\Documents\Visual Studio 2008\WebSites\WebSite1\Login.vb:30
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
I tried the above script but getting erro
Incorrect syntax near ‘LOGIN’.
Thanks! That fixed it!
Thx, mean while it works.
I have many servers, and one of them is in different network
We just do this
“Frank Stevens
This is for WINDOWS AUTHENTICATION:
I received this error when connecting to the SQL Server remotely via my application. After researching, I found that you had to both enable trusted authentication on my SQL Server machine and grant the User Right “Enable computer and user accounts to be trusted for delegation” (Group Policy…under Local Policies\User Rights Assignment) to the Windows account you are using. I just granted it for the Administrators group.
For the SQL Server machine, I set the property in Active Directory (check the box labeled “Trust computer for delegation” in the computer’s properties).
Make sure you for the group policy changes (gpupdate /force).”
so..our domain controller (on other network) had virus, virus attacking security system, sometime it grant the active directory and sometime it doesn’t (Aaarrgghh..)
I had the same problem.
SQL 2000 on a server in windows authentication mode.
The Active Directory role set in the SQL security tab.
My colleagues could log on to the server using the enterprice manager. I couldn’t, getting the same error “Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection”. Setting the server in mixed mode is no option because of business policy.
The solution:
With the windows explorer I connected to a shared directory on the server.
Problem solved.
I don’t understand why or how, but it works.
when we are running the insert statement with the linked server, it is working fine.
If i create the job , it is failing with the folowing error
Executed as user: SYNTEL\user1. Login failed for user ‘(null)’. Reason: Not associated with a trusted SQL Server connection. [SQLSTATE 28000] (Error 18452). The step failed.
We are getting the error in sql 2000.
Regards,
D.RamaKrishna
I am having the error
“Login failed for user ’sa’. The user is not associated with a trusted SQL Server connection.”.
I have Windows XP Service Pack 2,
I have MS SQL 2005 Express,
I can have either ‘Windows Authentication’ or ‘SQL server Authentication’ in SQL.
I have MS SQL Server Compact 3.5 Design, ENU,
I have MS SQL Server Native Client
I have just removed passwords for sa, and my login in the SQL server.
How can I solve this error please?
Thank you.
Solved.
The connectionstring line was at fault, it should have been
connectionString=”Data Source=.\SQLEXPRESS;INITIAL CATALOG=HandScanning;Integrated Security=SSPI;User Instance=False”
Instead of “Integrate Security=SSPU;user instance=false, ”
I had “id=PC\Aministrator;pwd=”
So this error can also relate to errors in the constuction of the
connectionstring
This advice is great unless you are ALREADY in mixed mode on SQL 2005 and STILL receiving the same error. The services HAVE been restarted and STILL receiving the same error. I am using Rightfax. It is trying to alert the database that the fax was successful. My System DSN (ODBC connection) verifies fine using SQL user and password, but when the Rightfax program goes to run the process, It gives me the dreaded User not associated error and the user is ”. This is maddening! I have spent two full days so far, but all I find is change the mode to mixed mode, I am already there!
I have already change the mode to “SQL Server and Windows Authentication mode” but I am still getting the error of “The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452).
Why is that ?
I have solved the problem, after changing the connection to “SQL Server and Windows Authentication mode”, I need to stop the SQL Server Service and SQL Server Agent Service and restart them.
Hi,
I too have the same problem. So long i am getting errors for SSPI handshake and login failed for the user etc. This blog was very helpful.. Thanks a lot…
For me, the solution was the host had two DNS names. So, I had changed the DNS to the same which is recognized under Network (My Computer –> Properties –> Network Identification) in client network utility. (Run –> cliconfg). Restart the SQL Server. It won’t show any more errors in Agent log & event viewer … It will allow windows authentication also…
Mine turned out to be a change to a registry key for Rightfax. I had to include a user and password in the registry key. Apparently Rightfax only looks at the ODBC driver for the server name, why bother at all?!
How could I run this code in Query Analyser if I’m unable to login to server?
http://social.msdn.microsoft.com/Forums/en/sqlsecurity/thread/48ee6a1b-9aad-48a6-90e4-b8f4b93d0107
also deals with this. The server may have to be set to support Mixed Authentication for non Windows Authentication logins to work. The install default is Windows Authentication only I think.
Thanks a lot for your article, it helped me to solve the problem. Good job!!!
Great Site. My PC had been renamed. “kaleeswar B” was correct. This caused the error. Many thanks for the advice.