[Database connection string] SQL server connection string

Source: Internet
Author: User
Tags sql server connection string

ODBC
 
Standard connection
Driver = {SQL Server}; server = myserveraddress; database = mydatabase; uid = myusername; Pwd = mypassword;
   
Trusted connection
Driver = {SQL Server}; server = myserveraddress; database = mydatabase; trusted_connection = yes;
   
Account and password
Oconn. properties ("prompt") = adpromptalways

Driver = {SQL Server}; server = myserveraddress; database = mydatabase;

   
Ole db, oledbconnection (. NET)
 
Standard connection
Provider = sqloledb; Data Source = myserveraddress; initial catalog = mydatabase; user id = myusername; Password = mypassword;
   
Trusted connection
Provider = sqloledb; Data Source = myserveraddress; initial catalog = mydatabase; Integrated Security = sspi;
You can use servername/InstanceName as the data source to specify an SQL server instance.
 
Connect to an SQL server instance
The expression of the specified server instance is the same as the connection string of other SQL servers.  
Provider = sqloledb; Data Source = myservername/theinstancename; initial catalog = mydatabase; Integrated Security = sspi;
   
Account and password
Oconn. provider = "sqloledb"
Oconn. properties ("prompt") = adpromptalways

Data Source = myserveraddress; initial catalog = mydatabase;

   
Use IP address connection
Provider = sqloledb; Data Source = 190.190.200.100, 1433; network library = dbmssocn; initial catalog = mydatabase; user id = myusername; Password = mypassword;
   
Sqlconnection (. NET)
 
Standard connection
Data Source = myserveraddress; initial catalog = mydatabase; user id = myusername; Password = mypassword;
   
Standard Security alternative syntax
Server = myserveraddress; database = mydatabase; user id = myusername; Password = mypassword; trusted_connection = false;
   
Trusted connection
Data Source = myserveraddress; initial catalog = mydatabase; Integrated Security = sspi;
   
Trusted connection alternative syntax
Server = myserveraddress; database = mydatabase; trusted_connection = true;
 
 
Connect to an SQL server instance
The expression of the specified server instance is the same as the connection string of other SQL servers.  
Server = myservername/theinstancename; database = mydatabase; trusted_connection = true;
   
Data Source = myserveraddress; initial catalog = mydatabase; Integrated Security = sspi; user id = mydomain/myusername; Password = mypassword;
Only applicable to CE devices.
 
 
Connections with IP addresses
Data Source = 190.190.200.100, 1433; network library = dbmssocn; initial catalog = mydatabase; user id = myusername; Password = mypassword;
 
 
Package Size
Server = myserveraddress; database = mydatabase; user id = myusername; Password = mypassword; trusted_connection = false; packet size = 4096;
The default package size is 8192 bytes.
 
Data shape
 
MS data shape
Provider = msdatashape; data provider = sqloledb; Data Source = myserveraddress; initial catalog = mydatabase; user id = myusername; Password = mypassword;
 
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.