当前位置:首页 > 开发教程 > mysql教程 >

MySQL Connection String Samples(4)

时间:2013-04-24 22:49 来源:网络整理 作者:采集侠 收藏

Server = myServerAddress ; Database = myDataBase ; Uid = myUsername ; Pwd = myPassword ; Connection Timeout = 5 ; Inactivating prepared statements Use this one to instruct the provider to ignore any

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Connection Timeout=5;

 

 

Inactivating prepared statements

Use this one to instruct the provider to ignore any command prepare statements and prevent corruption issues with server side prepared statements.

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Ignore Prepare=true;

The option was added in Connector/NET version 5.0.3 and Connector/NET version 1.0.9.

 

 

Specifying network protocol

Use this one to specify which network protocol to use for the connection.

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Protocol=socket;

"socket" is the default value used if the key isn't specified. Value "tcp" is an equivalent for "socket".

Use "pipe" to use a named pipes connection, "unix" for a Unix socket connection and "memory" to use MySQL shared memory.

 

 

Shared memory protocol

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Protocol=memory;Shared Memory Name=MYSQL;

It's possible to explicit set the shared memory object name used for communication.

 

 

Named pipes protocol

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Protocol=pipe;
PipeName=mypipename;

It's possible to explicit set the pipe name used for communication, if not set, 'mysql' is the default value.

 

 

Named pipes alternative

Server=myServerAddress;Port=-1;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

It is the port value of -1 that tells the driver to use named pipes network protocol. This is available on Windows only. The value is ignored if Unix socket is used.

 

 

Unix socket connection

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Protocol=memory;Shared Memory Name=MYSQL;

It's possible to explicit set the shared memory object name used for communication.

 

 

Specifying character set

Use this one to specify which character set to use to encode queries sent to the server.

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;CharSet=utf8;

Note! Use lower case value utf8 and not upper case UTF8 as this will fail.

Note that resultsets still are returned in the character set of the data returned.

 

 

eInfoDesigns.dbProvider

More info and class library downloads

Set example values

Standard

Data Source=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;
Command Logging=false;

 

 

SevenObjects MySqlClient

More info and class library downloads

Set example values

Standard

Host=myServerAddress;UserName=myUsername;Password=myPassword;Database=myDataBase;

 

 

dotConnect for MySQL (former MyDirect.NET and Core Labs MySQLDirect.NET)

More info and class library downloads

Set example values

Standard

User ID=root;Password=myPassword;Host=localhost;Port=3306;Database=myDataBase;
Direct=true;Protocol=TCP;Compress=false;Pooling=true;Min Pool Size=0;Max Pool Size=100;
Connection Lifetime=0;

 

 

MySQLDriverCS

More info and class library downloads

Set example values

Standard

mysql教程阅读排行

最新文章