SQL Server Database Connection string declaration

Source: Internet
Author: User
Tags account security

The common declarations in the connection string are:

The server declares Data Source, server, and addr.

Database declarations Initial catalog and databases.

Security statements for Integrated Windows accounts integrated and Trusted_Connection.

Use database account security to declare user IDs and password, and so on.

For access to the database account, usually we see in some resources ado.net string concatenation is often the following:

String connstr = "Server = localhost;

User ID = sa; Password = XXX; Database = Northwind ";

For an account that integrates Windows security, the connection string is typically written as follows:

String connstr = "Server = localhost;

Integrated Security = SSPI; Database = Northwind ";

or string connstr = "Server = localhost;

Trusted_Connection = yes; Database = Northwind ";

Using Windows Integrated Security authentication has many advantages in accessing the database: Higher security, faster access, less work to redesign the security architecture, hard coding of connection strings, etc., and is worth using.

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.