Integrated Security = SSPI/ture/false in the SQL connection statement

Source: Internet
Author: User

Erver = localhost; database = Northwind; integrated security = SSPI

Microsoft security support providers' interface (SSPI) is a well-defined public API used to obtain integrated security services such as verification, information integrity, and information privacy, and security services for all distributed application protocols. The application protocol designer can use this interface to obtain different security services without modifying the protocol itself.

The above sentence means that this connection uses this interface, and an error will occur if it is not defined!

Integrated Security authentication method
If this parameter is set to false, the user ID and password are specified in the connection.
If this parameter is set to true, the current Windows account creden。 are used for authentication.
The identifiable values are true, false, yes, no, and sspi equivalent to true.

Indicates that you use the security authentication mechanism provided by windows. In this case, you can open the database without adding uid and password.
If you do not have that sentence, you must write uid = sa in the join string; password = 00;
Otherwise, you cannot open the database.


Integration Security = SSPI in SQL connection statements

Solution:

Security Support Provider Interface

When the value of Integrated Security is set to True, the user ID in front of the connection statement PW does not work, that is, the windows authentication mode is used.

The connection is based on UserID and PW only when it is set to False or this item is omitted.

Integrated Security can be set to: True, false, yes, no. The four values are clear and can also be set to: sspi, which is equivalent to True. We recommend that you use this instead of True.

What is the difference between initial catalog and database?

Initial Catalog:

DataBase:

There is no difference between the two, but the names are different, just like the real names of humans and old names .. Can call you.

**************************************** ****

Integrated Security = SSPI indicates that the current WINDOWS system user logs on to the SQL server. If the SQL SERVER does not support this method, an error occurs.

You can use the username and password of SQL SERVER to log on, for example:

The code is as follows: Copy code

"Provider = SQLOLEDB.1; Persist Security Info = False; Initial Catalog = database name; Data Source = 192.168.0.1; User ID = sa; Password = Password"

**************************************** ***********

If the value of Integrated Security-or-Trusted_Connection 'false' is false, the user ID and password are specified in the connection. If this parameter is set to true, the current Windows account creden。 are used for authentication. The identifiable values are true, false, yes, no, and sspi equivalent to true (strongly recommended ).

**************************************** *********

Database connection method in ADO.net

System. Data. SqlClient. SqlConnection

Commonly used connection strings (C # code ):

The code is as follows: Copy code

SqlConnection conn = new SqlConnection ("Server = (local); Integrated Security = SSPI; database = Pubs");

SqlConnection conn = new SqlConnection ("server = (local) NetSDK; database = pubs; Integrated Security = SSPI");

SqlConnection conn = new SqlConnection ("Data Source = localhost; Integrated Security = SSPI; Initial Catalog = Northwind;");

SqlConnection conn = new SqlConnection ("data source = (local); initial catalog = xr; integrated security = SSPI;

Persist security info = False; workstation id = XURUI; packet size = 4096; ");

SqlConnection myConn = new System. Data. SqlClient. SqlConnection ("Persist Security Info = False; Integrated

Security = SSPI; database = northwind; server = mySQLServer ");

SqlConnection conn = new SqlConnection ("uid = sa; pwd = passwords; initial catalog = pubs; data source = 127.0.0.1; Connect Timeout = 900");

Network-related or instance-specific errors occur when you establish a connection with SQL Server. The server is not found or cannot be accessed. Verify that the instance name is correct and SQL Server is configured to allow remote connection. (Provider: Named pipeline provider, error: 40-unable to open the connection to SQL Server)

If sql2000 is installed on your machine, Data Source =. Certainly not.

Because the default values of instance 2000 and 2005 are the same, 2005 instances cannot be represented by Data Source =.

Check the instance name of sql2005 and replace SQLEXPRESS in Data Source =. SQLEXPRESS with your new instance name.

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.