数据库的连接字符串经常使用,可是数据库的种类繁多,连接方式又分很多种,下面提供各个数据库各种方式的连接字符串方便使用的时候查询。
MySQL
MyODBC连接方式
OLE DB, OleDbConnection
连接方式
(.NET)
MyODBC 2.50本地数据库
Driver
=
{mySQL}
;
Server
=
localhost
;
Option
=
16834
;
Database
=
myDataBase
;
MyODBC 2.50远程数据库
Driver
=
{mySQL}
;
Server
=
myServerAddress
;
Port
=
3306
;
Option
=
131072
;
Stmt
=
;
Database
=
myDataBase
;
Uid
=
myUsername
;
Pwd
=
myPassword
;
MyODBC 3.51本地数据库
Driver
=
{MySQL ODBC 3.51 Driver}
;
Server
=
localhost
;
Database
=
myDataBase
;
User
=
myUsername
;
Password
=
myPassword
;
Option
=
3
;
MyODBC 3.51远程数据库
Driver
=
{MySQL ODBC 3.51 Driver}
;
Server
=
data.domain.com
;
Port
=
3306
;
Database
=
myDataBase
;
User
=
myUsername
;
Password
=
myPassword
;
Option
=
3
;
标准连接
Provider=
MySQLProv;
Data Source=
mydb;
User Id=
myUsername;
Password=
myPassword;
Connector/Net 1.0
连接方式
(.NET)
标准连接
默认端口是3306
Server=
myServerAddress;
Database=
myDataBase;
Uid=
myUsername;
Pwd=
myPassword;
指定端口
Server=
myServerAddress;
Port=
1234;
Database=
myDataBase;
Uid=
myUsername;
Pwd=
myPassword;
命名管道
如果端口号为 -1 就是告诉驱动使用命名管道协议
Server=
myServerAddress;
Port=
-1;
Database=
myDataBase;
Uid=
myUsername;
Pwd=
myPassword;
MySqlConnection
连接方式
(.NET)
eInfoDesigns.dbProvider
Data Source
=
myServerAddress
;
Database
=
myDataBase
;
User ID
=
myUsername
;
Password
=
myPassword
;
Command Logging
=
false
;
SevenObjects MySqlClient
连接方式
(.NET)
标准连接
Host=
myServerAddress;
UserName=
myUsername;
Password=
myPassword;
Database=
myDataBase;
Core Labs MySQLDirect连接方式 (.NET)
标准连接
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
连接方式
(.NET)
标准连接
Location=
myServerAddress;
Data Source=
myDataBase;
User ID=
myUsername;
Password=
myPassword;
Port=
3306;
Extended Properties=
"""";