Standard connection for SQL Server authentication:

Source: Internet
Author: User

Standard connection for SQL Server authentication:

Data Source = myServerAddress; Initial Catalog = myDataBase; User Id = myUsername; Password = myPassword;

Server =. sqlexpress; database = testDB; uid = sa; pwd = 123456

If you want to use a remote Server to run SQL Server (localhost), you should assign the correct Server to the Data Source attribute in the sample object. In addition, you must specify either of the two supported authentication methods (Windows Authentication and SQL Server authentication. Windows Authentication uses Windows login user identity to connect to the database tutorial, and SQL authentication requires explicitly specifying the SQL Server user ID and password. To use Windows Authentication, you must include the Integrated Security attribute in the connection string:

Data Source = ServerName; Integrated Security = True;
 

 

By default, the Integrated Security attribute is False, which means Windows Authentication is disabled. If the value of this attribute is not explicitly set to True, the connection uses SQL Server Authentication. Therefore, the SQL Server user ID and password must be provided. The Integrated Security attribute can recognize other values only SSPI (Security Support Provider Interface, Security Support Provider Interface ). All Windows NT operating systems, including Windows NT 4.0, 2000, and XP, support SSPI. It is the only interface that can be used for Windows Authentication. It is equivalent to setting the value of Integrated Security to True.

When using the connection method of SQL Server, take the local Server (LocalHost) and database (testDB) as an example, you can use the following connection methods:

Data Source = LocalHost; Initial Catalog = testDB; Integrated Security = SSPI; Persist Security Info = False; Workstation Id = XXX; Packet Size = 4096;
 

 

Server = LocalHost; Persist Security Info = False; Integrated Security = SSPI; Database = testDB;
Uid = sa; Pwd = sa; Initial Catalog = Northwind; Data Source = LocalHost; Connect Timeout = 20;
 

 

In Windows authentication mode, SQL Server uses the Windows security subsystem to verify the validity of user connections. Even if the user ID and password are explicitly specified, SQL Server does not check the user ID and password in the connection string. Because only Windows NT, 2000, and XP support SSPI, if you are using these operating systems, you can only use Windows integrated security policies to connect to SQL Server. No matter which operating system you use, when using SQL Server Authentication, you must specify the user ID and password in the connection string:

Server = ServerName, Data Source = DB; User ID = ID; Password = pwd

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.