SQL Server Connection String learning

Source: Internet
Author: User
Tags sql server connection string

Problems encountered while using connection string

The string is as follows "Data source= ******;initial catalog=******; Persist Security info=true;integrated security=true; User Id=sa; password=******; Connect timeout=10 "

Issue One: Connection prompts Windows user permissions and other errors

This problem should be the local Windows user cannot connect to the remote database server, the related property is "Integrated security=true"

Integrated Security=true Connection Property Description: See http://www.cnblogs.com/zxjyuan/archive/2009/03/11/1408991.html

Integrated Security Authentication method
When False, a user ID and password are specified in the connection.
When True, the current Windows account credentials are used for authentication.
The recognized values are true, false, yes, no, and SSPI that is equivalent to true.

The Microsoft Security Support Provider Interface (SSPI) is a well-defined public API that is used to obtain integrated security services such as authentication, information integrity, information privacy, and security aspects for all distributed application protocols. The Application Protocol designer can take advantage of this interface to obtain different security services without modifying the protocol itself.

The above sentence means that this connection uses this interface, if there is no definition will be wrong!

When you use the security authentication mechanism that comes with Windows, you can open the database without adding UID and password
If you do not have that sentence, you must write the uid=sa;password=00 in the connection string;
Otherwise, you can't open the database.

Issue two: Connect timeout=10 is not valid, it will wait a long time (around 40s)

This problem may occur because the machine is not connected to the database host, and the timeout attribute set is valid when connected

Other Notes

Persist Security info=true See http://blog.csdn.net/yzsind/article/details/1507717

The Persist Security Info property is meant to indicate whether or not to save secure information, in fact, it can be simply understood as "whether ADO saves password information after a successful database connection",

True means save, false means no save

ADO defaults to True
(the default for ADO is False, not tested, according to reference)

So the default false is generally used

SQL Server Connection String learning

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.