In-depth analysis of SQL data connection problems _ MySQL

Source: Internet
Author: User
In-depth analysis of some SQL data connection problems bitsCN.com has not been very familiar with the differences between the keywords in connectionstring, so it is too cumbersome
Let's explain some of the insights ......
**************************************** ***********
What is the difference between initial catalog and database?
Initial Catalog; DataBase:
In fact, there is no difference between the two, but the names are different, just like the real names of human beings and the 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:
"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 ):

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");
BitsCN.com

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.