'User 'sa 'Logon Failed. This user is not associated with a trusted SQL server connection and connects to the database as a JSP Project

Source: Internet
Author: User
Tags microsoft sql server 2005

When connecting to the database using a JSP project today, an error is returned because the 'user 'sa 'logon fails. This user is not associated with a trusted SQL server connection '. I have been online for a long time today, but I still cannot find it. I finally summarized it online and in the book. The specific method is: 1: Open the SQL Server Manager! On the left side, right-click 'security' and choose 'new'. In the "Logon" dialog box, enter your login number in the login name, select 'sqlserver Authentication', and enter the password, you can cancel 'user password must be changed upon next logon. Click User ing. On the right, select the database to be mapped and check the database! In the following column, check 'db-owner' and 'public. Click 'status' and select "authorize" and "enable" in the right pane. These two items are generally default, but if they are not by default, they must be changed, otherwise, it cannot be connected! Click confirm '. 2: Find the SQL Server, right-click it on the left bar, and select the "attribute" command in the pop-up menu. In the displayed dialog box, click "security" and select "SQL Server and Windows Authentication Mode" under "Server Authentication". Check the preceding figure! Remember that this step is very important. If you do not have this step, you do not want to log on successfully! Click OK! 3: restart the service and select SQL Server Authentication Mode to log on! It turned out that it was useless to find all the methods on the Internet. I finally found that I was in a hurry and forgot to start the server. The key point was to be calm. Don't learn me.Remember: The sql2005 service must be restarted to take effect.. I have found several methods for your reference.

SQL server2005 Common Errors and Solutions

Problem 1: I forgot the SA logon password for logging on to Microsoft SQL Server 2005.

Solution: use Windows authentication to log in, and then right-click 'sa '-'properties' in 'security'-'logins'. Change the password and click confirm.

Problem 2: A connection has been established with the server, but an error occurs during logon. (Provider: Shared Memory provider, error: 0-there is no process on the other end of the MPs queue .) (Microsoft SQL Server, error: 233)

Solution: Open 'project'-'All projects'-'Microsoft SQL Server 100'-'configuration tool'-'SQL Server Configuration Manager'. In the displayed form, find 'SQL Server 2005 network configuration', start "named pipes" and "TCP/IP" under the 'mssqlserver Protocol', and then restart Microsoft SQL Server 2005.

Problem 3: The default database cannot be opened. Logon Failed. User 'sa 'Login Failed. (Microsoft SQL Server, error: 4064)

Solution: use Windows authentication to log in, and then right-click 'sa '-'properties' in 'security'-'logins' to set the default database to a master, click OK.

Problem 4: SQL Server 2005 Error 18452
Unable to connect to the server
Server: Message18452,Level 16, status 1
[Microsoft] [ODBCSQLServerDriver] [SQLServer] user 'sa 'Login Failed. Cause: SQL is not trustedServer connection Association

This error is caused by SQLServer uses "onlyWindows "authentication method, so users cannot use SQLServer login account (for exampleSA). The solution is as follows:

Set allow SQLServer identity Logon(Basically this is useful)
Procedure:
1. In the Enterprise Manager, expand SQLServer group ", right-click SQLServer Name
2. Select "properties"
3. Select the "Security" tab.
4. Under "authentication", select "SQLServer andWindows"
5. OK, and restart SQLServer ServiceProblem 5: User 'sa 'Logon Failed. This user is not associated with a trusted SQL server connection. Solution: Check the Authentication Mode of your database. For Windows and hybrid modes, select hybrid mode for SA logon.
Check whether port 1433 and port 1434 are enabled.

For SQL 2005, go to "security" = "" user "=" and double-click the user (the pop-up attribute dialog box) = "status" to change the status to enable, log out of the manager and log on again (User Authentication Mode)

That is, right-click the database Properties dialog box, select the "Security" tab, and select "SQL Server and Windows Authentication Mode" for Server Authentication mode.. Then, reconfigure the SA login information.

Failed to log on to SQL Server 2005 using Sa-a message is displayed, indicating that the user is not associated with a trusted SQL server connection.
Error message:
Sa Logon Failed, prompting that the user is not associated with a trusted SQL server connection
Solution:
Open SQL Server Management studio Express,
Right-click the server, select properties, and click Security in the pop-up window to switch to the security panel,
Authentication Server Authentication from Windows Authentication Mode (Windows User Authentication Mode)
Change to SQL Server and Windows Authentication Mode (SQL Server and Windows Authentication mode), OK.
Open security-logins (login name), right-click SA, select properties, and click status to switch to status panel) enabled ).

If it still doesn't work, let's take the last step ......
Change the server that connects to the string
The default value is as follows:

Code:
Data Source=./SQLEXPRESS;

After modification:

Code:
Data Source=localhost;
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.