Java connection to various pitfalls of sqlserver (test by cainiao) and javasqlserver

Source: Internet
Author: User

Java connection to various pitfalls of sqlserver (test by cainiao) and javasqlserver

 

As a cainiao, when I first started to use java to connect to sqlserver, it took a short time,

I think it is necessary to share my experience with you.

(Because I step on most pitfalls)

First pitfall: load the driver. Java requires a driver to connect to the database. We will download

Sqljdbc. jar is enough. What should I do after the download.

At this time, we add a file in the project, paste the package, and right-click the package.

Add the build path. At this time, you thought it was done, but there are still many pitfalls.

The second pitfall: "Failed to load the sqljdbc_auth.dll". For this, we only need to download

Sqljdbc_auth.dll is enough, but I went down and found various hooligans in it,

So I went to csdn to get another one, which is quite easy to use. After downloading the file, assign it to drive C for windows.

Directory.

You thought it was done, but it didn't.

Third pitfall: Database verification method. As a rookie, it may be the first time SQL Server was installed.

Do not pay attention to the authentication method. However, this affects java connection.

I am the cainiao. I chose Windows verification at the beginning, but it is displayed during connection.

"This login name is from an untrusted domain and cannot be used together with Windows Authentication"

I tried Baidu for a moment and found a lot. I asked the same questions online. Someone replied, "The verification methods are mixed"

After reading this, I understand how to solve the problem by mixing the verification methods. There are not many answers online.

I have summarized the following methods: Step 1: after entering the authentication with windows,

Right-click Properties

Switch the Authentication mode to the following one.

Then

Select the sa user name in the login name and change the password.

The next step is the fourth pitfall. Change the password and log on again. The password is correct but cannot be logged on.

I tried it again and finally solved it.

 

Right-click and Select Restart to start the instance.

I am a beginner in the freshman year. Sorry.

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.