Solution: [Microsoft] [SQL Server 2000 driver for JDBC] [sqlserver] user 'sa 'Login Failed

Source: Internet
Author: User

I have to write down some of the problems that I have encountered many times. The lessons have been delayed for a lot of time.

Problem description

Write a code to connect to the Database SQL Server in Java;

As follows:

Import java. SQL .*;

Public class tosql2000 {
Public static void main (string [] SRG ){
String drivername = "com. Microsoft. JDBC. sqlserver. sqlserverdriver"; // load the JDBC driver
String dburl = "JDBC: Microsoft: sqlserver: // localhost: 1433; databasename = Try"; // connect to the server and database sample
String username = "sa"; // Default User Name
String userpwd = ""; // Password
Connection dbconn;

Try {
Class. forname (drivername );
Dbconn = drivermanager. getconnection (dburl, username, userpwd );
System. Out. println ("connection successful! "); // If the connection is successful, the console outputs connection successful!
} Catch (exception e ){
E. printstacktrace ();
}
}
}

When running, eclipse reports the following error: [Microsoft] [SQL Server 2000 driver for JDBC] [sqlserver] user 'sa 'Logon Failed. This user is not associated with a trusted SQL server connection.

 

If the user name and password are determined to be correct, make sure that JDBC is correct and patch SP3 is installed.

Still unsolved.

Finally, modify the settings in the Enterprise Manager of SQL Server, for example:

Solve the problem.

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.