关键词不能为空

当前您在: 主页 > 英语 >

SQL server 和MySQL的 connectionstring大全

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-15 14:07
tags:

-

2021年2月15日发(作者:agitation)



SQL SERVER






Standard Security


Data Source


=


mySer verAddress;


Initial Catalog


=< /p>


myDataBase;


User


Id


=


myUsername;


Passw ord


=


myPassword;






Standard Security alternative syntax


This connection string produces the same result as the previous one. The reason to include it is to


point out that some connection string keywords have many equivalents.


Server


=


myServerAd dress;


Database


=


my DataBase;


User


ID


=


myUsername;


Password

=


myPassword;


Trusted_Connec tion


=


False;






Trusted Connection


Data Sour ce


=


myServerAddress;

Initial Catalog


=


myDataBase ;


Integrated


Security

< br>=


SSPI;






Trusted Connection alternative syntax


This connection string produce the same result as the previous one. The reason to include it is to


point out that some connection string keywords have many equivalents.


Server< /p>


=


myServerAddress;


D atabase


=


myDataBase;

Trusted_Connection


=


True;



Use serverNameinstanceName as Data Source to use a specific SQL Server instance. Please note


that the multiple SQL Server instances feature is available only from SQL Server version 2000 and


not in any previous versions.




Connecting to an SQL Server instance



The syntax of specifying the server instance in the value of the server key is the same for all


connection strings for SQL Server.


Server


=

< p>
myServerNametheInstanceName;


Datab ase


=


myDataBase;


Tr usted_Connection


=


T


rue;






Trusted Connection from a CE device


Often a Windows CE device is not authenticated and logged in to a domain. To use SSPI or trusted


connection / authentication from a CE device, use this connection string.


Data Source

=


myServerAddress;


Initial C atalog


=


myDataBase;


Integrated


Security


=


SSPI;


User ID


=


myDomainmyUsername;


Password


=


myPassword;



Note that this will only work on a CE device.


Read more about connecting to SQL Server from CE devices here





Connect via an IP address


Data Source


=


190.1 90.200.100,1433;


Network Library

< br>=


DBMSSOCN;


Initial


Catalog


=


myDataBase;

< p>
User ID


=


myUsername;


Password


=


myPassword;





Specifying packet size


Serve r


=


myServerAddress;


Database


=


myDataBase;


User


ID


=


myUse rname;


Password


=


my Password;


Trusted_Connection


=


False;


Packet Size


=


4096;



By default, the Microsoft .NET Framework Data Provider for SQL Server sets the network packet


size to 8192 bytes. This might however not be optimal, try to set this value to 4096 instead.


The default value of 8192 might cause errors as well (


check this out





Microsoft OLE DB Provider for SQL Serv


er


Type:


OLE DB Provider


Usage:



Provider=sqloledb


Manufacturer:


Microsoft


More info about this provider ?



Customize string


example values ?



Standard Security


Provider


=


sqloledb;


Data Sour ce


=


myServerAddress;

Initial Catalog


=


myDataBase ;


User


Id


=

< br>myUsername;


Password


=

< p>
myPassword;






Trusted connection


Provider


=

< br>sqloledb;


Data Source


=


myServerAddress;


Initial

< br>Catalog


=


myDataBase;


Integrated Security


=


SSPI;



Use serverNameinstanceName as Data Source to use a specific SQL Server instance. Please note


that the multiple SQL Server instances feature is available only from SQL Server version 2000 and


not in any previous versions.




Connecting to an SQL Server instance



The syntax of specifying the server instance in the value of the server key is the same for all


connection strings for SQL Server.


Provider


=


sqloledb;


Data Source


=


myServerNametheInstanceName;


Initial


Catalog


=


myDataBase;


Integrated Security


=


SSPI;






Prompt for username and password


This one is a bit tricky. First set the connection object's Provider property to


set the connection object's Prompt property to adPromptAlways. Then use the connection string to


connect to the database.



er =


ties(



Data Source


=


myServerAddress;


Initial Catalog


=


myDataBase;< /p>






Connect via an IP address


Pr ovider


=


sqloledb;


D ata Source


=


190.190.200.100,1 433;


Network


Library

=


DBMSSOCN;


Initial Catalog< /p>


=


myDataBase;


User < /p>


ID


=


myUsername;


Password


=


myPassword;< /p>



DBMSSOCN=TCP/IP. This is how to use TCP/IP instead of Named Pipes. At the end of the Data


Source is the port to use. 1433 is the default port for SQL Server.


How to define which network protocol to use





Disable connection pooling


This one is usefull when receving errors



application role enabled connection. Application pooling (or OLE DB resource pooling) is on by


default. Disabling it can help on this error.


Pr ovider


=


sqloledb;


D ata Source


=


myServerAddress;< /p>


Initial Catalog


=


my DataBase;


User


ID


=


myUsername;


Password

=


myPassword;


OLE DB Services


=


-2;






.NET Framework Data Provider for OLE DB



Type:


.NET Framework Wrapper Class Library


Usage:



onnection


Manufacturer:


Microsoft


More info about this wrapper class library ?



Customize string


example values ?



Bridging to OLE DB Provider for SQL Server


This is just one connection string sample for the wrapping OleDbConnection class that calls the


underlying OLEDB provider. See respective OLE DB provider for more connection strings to use


with this class.


Provider


=


S QLOLEDB;


Data Source


=

< br>myServerAddress;


Initial Catalog

< p>
=


myDataBase;


User

< p>
Id


=


myUsername;

< br> Password


=


myPassword;






Microsoft SQL Server ODBC Driver



Type:


ODBC Driver


Usage:



Driver={SQL Server}


Manufacturer:


Microsoft


Customize string


example values ?



Standard Security


Driver


=


{SQL

< p>
Server};


Server


=


myServerAddress;


Database


=


myDataBase;


Uid


=< /p>


myUsername;


Pwd


=


myPass


word;






Trusted connection


Driver


=


{SQL

< p>
Server};


Server


=


myServerAddress;


Database


=


myDataBase;


Trusted_Connecti on


=


Yes;






Prompt for username and password


This one is a bit tricky. First you need to set the connection object's Prompt property to


adPromptAlways. Then use the connection string to connect to the database.



ties(



Driver


=


{SQL Serve r};


Server


=


myServe rAddress;


Database


=


myDataBase;






SQL Server Native Client 10.0 OLE DB Provider



Type:


OLE DB Provider


Usage:



Provider=SQLNCLI10


Manufacturer:


Microsoft


More info about this provider ?



Customize string


example values ?



Standard security


Note that the SQL Server Native Client OLE DB Provider does not support SQL Server 7.0.


Provider


=


SQLNCLI10;


Server


=


myServerAddress;


Dat abase


=


myDataBase;


Uid


=


myUsername;


< /p>


Pwd


=


myPassword;






Trusted connection


Provider< /p>


=


SQLNCLI10;


Server< /p>


=


myServerAddress;


D atabase


=


myDataBase;


Trusted_Connection


=


yes;



Equivalent key- value pair:




Connecting to an SQL Server instance



The syntax of specifying the server instance in the value of the server key is the same for all


connection strings for SQL Server.


Provider


=


SQLNCLI10;


Server


=


myServerNametheInstanceName;


Dat abase


=


myDataBase;



Trusted_Connection


=

yes;






Prompt for username and password


This one is a bit tricky. First you need to set the connection object's Prompt property to


adPromptAlways. Then use the connection string to connect to the database.



ties(




=


SQLNCLI10;

< p>
Server


=


myServerAddress ;


DataBase


=


myDataB ase;






Encrypt data sent over network


Provider


=


SQLNCLI10;


Server


=


myServerAddress;


Database


=


myDataBase;



Trusted_ Connection


=


yes;


En crypt


=


yes;






SQL Native Client 9.0 OLE DB provider



Type:


OLE DB Provider


Usage:



Provider=SQLNCLI


Manufacturer:


Microsoft


More info about this provider ?



Customize string


example values ?



Standard security


Note that the SQL Server Native Client OLE DB Provider does not support SQL Server 7.0.


Provider


=


SQLNCLI;


Server

< p>
=


myServerAddress;


Datab ase


=


myDataBase;


Ui d


=


myUsername;



Pwd


=


myPassword;

< p>





Trusted connection


Provider< /p>


=


SQLNCLI;


Server


=


myServerAddress;


Dat abase


=


myDataBase;



Trusted_Connection


=

yes;



Equivalent key-value pair:




Connecting to an SQL Server instance



The syntax of specifying the server instance in the value of the server key is the same for all


connection strings for SQL Server.


Provider


=


SQLNCLI;


Server


=

< p>
myServerNametheInstanceName;


Datab ase


=


myDataBase;


< /p>


Trusted_Connection


=


yes;






Prompt for username and password


This one is a bit tricky. First you need to set the connection object's Prompt property to


adPromptAlways. Then use the connection string to connect to the database.



ties(




=


SQLNCLI;


Server


=


myServerAddress;< /p>


DataBase


=


myDataBas e;






Encrypt data sent over network

< br>Provider


=


SQLNCLI;

< br>Server


=


myServerAddress;


Database


=


myDataBase ;



Trusted_Connection

< br>=


yes;


Encrypt


=< /p>


yes;






SQL Server Native Client 10.0 ODBC Driver



Type:


ODBC Driver


Usage:



Driver={SQL Server Native Client 10.0}


Manufacturer:


Microsoft


More info about this driver ?



Customize string


example values ?



Standard security


Driver


=


{SQL Server Native Client


10.0};


S erver


=


myServerAddress;


Database


=


myDataBase;


Uid


=


myUsername;

< p>
Pwd


=


myPasswo


rd;






Trusted Connection


Driver


=


{SQL Server Native Client


10.0};


S erver


=


myServerAddress;


Database


=


myDataBase;


Trusted_Connection


=


y es;



Equivalent key-value pair:




Connecting to an SQL Server instance



The syntax of specifying the server instance in the value of the server key is the same for all


connection strings for SQL Server.


Driver


=


{SQL Server Native Client 10.0};


Server


=


myServerNametheInstanceName;

< p>


Database


=


m yDataBase;


Trusted_Connection


=


yes;






Prompt for username and password


This one is a bit tricky. First you need to set the connection object's Prompt property to


adPromptAlways. Then use the connection string to connect to the database.



ties(



Driver


=


{SQL Server Native Client


10.0};


S erver


=


myServerAddress;


Database


=


myDataBase;






Encrypt data sent over network


Driver


=


{SQL Server Native Client


10.0};


S erver


=


myServerAddress;


Database


=


myDataBase;



Trusted_Connection


=


yes;


Encrypt


=

< p>
yes;






SQL Native Client


9.0 ODBC Driver



Type:


ODBC Driver


Usage:



Driver={SQL Native Client}


Manufacturer:


Microsoft


More info about this driver ?



Customize string


example values ?



Standard security


Driver


=


{SQL Native Client};


Server


=


myServerAddress;


Database


=


myDataBase;



Uid


=


myUsername;


Pwd


=


myPassword;






Trusted Connection


Driver


=


{SQL Native Client};


Server


=


myServerAddress;


Database


=


myDataBase;



Tru sted_Connection


=


yes;

< br>


Equivalent key-value pair:




Connecting to an SQL Server instance



The syntax of specifying the server instance in the value of the server key is the same for all


connection strings for SQL Server.


Driver


=


{SQL Native


Client};


Server


=


myServerNametheInstanceName;


Database


=


myDataBase;



Trusted_Connection


=


yes;






Prompt for username and password


This one is a bit tricky. First you need to set the connection object's Prompt property to


adPromptAlways. Then use the connection string to connect to the database.



ties(



Driver


=


{SQL Native Client};


Server


=


myServerAddress;


Database


=


myDataBase;






Encrypt data sent over network


Driver


=


{SQL Native Client};


Server


=


myServerAddress;


Database


=


myDataBase;



Tru sted_Connection


=


yes;

< br>Encrypt


=


yes;






.NET Framework Data Provider for ODBC



Type:


.NET Framework Wrapper Class Library


Usage:



nnection


Manufacturer:


Microsoft


More info about this wrapper class library ?



Customize string


example values ?



Bridging to SQL Native Client 10.0 ODBC Driver


This is just one connection string sample for the wrapping OdbcConnection class that calls the


underlying ODBC Driver. See respective ODBC driver for more connection strings to use with this


class.


Driver


=


{SQL Server Native Client


10.0};


S erver


=


myServerAddress;


Database


=


myDataBase;


Uid


=


myUsername;

< p>
Pwd


=


myPasswo


rd;






SQLXML 3.0 OLEDB Provider



Type:


OLE DB Provider


Usage:



Provider=SQLXMLOLEDB.3.0;Data Provider=sqloledb


Manufacturer:


Microsoft


More info about this provider ?



Customize string


example values ?



Using SQL Server Ole Db


The SQLXML version 3.0 restricts the data provider to SQLOLEDB only.


Provider


=


SQLXMLOLEDB.3.0;


Data Provider


=


SQLOLEDB;


Data

< p>
Source


=


myServerAddress ;


Initial Catalog


=


myDataBase;


User


Id


=


myUsername;


Password


=


myPassword;






MSDataShape


Type:


Data Shaping COM component


Usage:



Provider=MSDataShape;Data Provider=providername


Manufacturer:


Microsoft


More info about this wrapper COM component ?


-


-


-


-


-


-


-


-



本文更新与2021-02-15 14:07,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/655389.html

SQL server 和MySQL的 connectionstring大全的相关文章

  • 爱心与尊严的高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊严高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊重的作文题库

    1.作文关爱与尊重议论文 如果说没有爱就没有教育的话,那么离开了尊重同样也谈不上教育。 因为每一位孩子都渴望得到他人的尊重,尤其是教师的尊重。可是在现实生活中,不时会有

    小学作文
  • 爱心责任100字作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任心的作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文