Analysis on jdbc connection to SQL server database

Source: Internet
Author: User

There are many problems with SQL Server connection. If you do not set it, you cannot connect it. Please note here! (Some materials are from the Internet)

Problems with JDBC connection to MySQL

(The example contains the JDBC2005 driver. In the lib folder, right-click Build Path ---> add to build path)

Run the connectionSqlServer2005 packageJavaConnectionSQLClass!

1. Driver Problems:

JDBC2005 and JDBC2008 must be seated on the right. Otherwise, an error will be reported! (I use 2008)

2. Service Startup Problems:

In fact, in many cases, the connection fails because your service is not started!

Run -----> enter services. msc ----- to find the SQL Server service and start it.

If you are not at ease, start all SQL Server services!

3. Logon account and password Problems

Root Cause: Many users do not set it during installation and only use Windows authentication to log on.

3.1 SET Password

After logging on, create a query connection and enter:Exec sp_password null, 'sa ', 'sa'-- Change the sa password to sa. The first one is the password and the last one is the user name.

3.2 set SQL Server Authentication Login(If this parameter is not setAn error occurred while logging on to SQL server user 'sa '.)

1. Open the database-log on to the database as a Windows User

2,Login Name -- double-click sa (Open attribute)

3,General -- set password -- OK (as described above, here is the visual setting)

4,Status -- Logon: enabled -- OK

5,Right-click the server name -- Properties

6,Security -- select SQL Server and Windows Authentication mode -- OK

7. Right-click the server name -- restart -- close the database connection and exit the program -- log on to the database with sa

4. Everything is OK. The connection is successful under Eclipse.

Execution result:

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.