Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Pooling=False;
Connection state reset when obtained from pool
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;ConnectionReset=True;
Makes an additional round trip to the server when obtaining a connection from the pool and connection state will be reset.
Recycle connections in pool
This is useful in load balancing scenarios when available servers change you don't want 100 constant connections in the pool pointing to only one server.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;ConnectionLifeTime=300;
Specified in seconds, the amount of time after connection object creation the connection will be destroyed. Destruction will only happen when connections are returned to pool.
Do not update server settings on connections in pool
A connection might be long lived in the pool, however the connections server settings are updated (SHOW VARIABLES command) each time returned to the pool. This makes the client use of the connection object up to date with the correct server settings. However this causes a round trip and to optimize pooling performance this behaviour can be turned off.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;CacheServerProperties=True;
This option is available from Connector/NET version 6.3
Use Windows authentication
Server=myServerAddress;Database=myDataBase;IntegratedSecurity=yes;Uid=auth_windows;
This option is available from Connector/NET version 6.4.4
The Windows Native Authentication Plugin must be installed for this to work.
Keep TCP Sockets alive
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Keepalive=10;
Number of seconds between each keep-alive package send.
Use BINARY(16) GUIDs
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;OldGuids=True;
This option is available from Connector/NET version 6.1.1
Disable Stored procedure cache
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;ProcedureCacheSize=0;
The default is 25, meaning that stored procedure meta data (such as input/output data types etc) for the latest 25 called procedures will be cached in client memory.
This option is available from Connector/NET version 5.0.2
Allow square brackets around symbols (instead of backticks)
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;sqlservermode=True;
This enables Visual Studio wizards that bracket symbols with [] to work with Connector/Net. This option incurs a performance hit, so should only be used if necessary.
This option is available from Connector/NET version 6.3.1
Specifying default command timeout
Use this one to specify a default command timeout for the connection. Please note that the property in the connection string does not supercede the individual command timeout property on an individual command object.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;default command timeout=20;
This option is available from Connector/NET version 5.1.4.
Specifying connection attempt timeout
Use this one to specify the length in seconds to wait for a server connection before terminating the attempt and receive an error.
热门源码