MyODBC
MyODBC 2.50 Local database:
"Driver={mySQL};
Server=localhost;
Option=16834;
Database=mydatabase;"
MyODBC 2.50 Remote database:
"Driver={mySQL};
Server=data.domain.com;
Port=3306;
Option=131072;
Stmt=;
Database=my-database;
Uid=myUsername;
Pwd=myPassword;"
MyODBC 3.51 Local database:
"DRIVER={MySQL ODBC 3.51 Driver};
SERVER=localhost;
DATABASE=myDatabase;
USER=myUsername;
PASSWORD=myPassword;
OPTION=3;"
MyODBC 3.51 Remote database:
"DRIVER={MySQL ODBC 3.51 Driver};
SERVER=data.domain.com;
PORT=3306;
DATABASE=myDatabase;
USER=myUsername;
PASSWORD=myPassword;
OPTION=3;"
OLE DB, OleDbConnection
(.NET)
Standard:
"Provider=MySQLProv;
Data Source=mydb;
User Id=myUsername;
Password=myPassword;" *Connector/Net 1.0 (.NET)
Standard:
"Server=Server;
Database=Test;
Uid=myUsername;
Pwd=myPassword;"
Specifying port:
"Server=Server;
Port=1234;
Database=Test;
Uid=myUsername;
Pwd=myPassword;"
Note: Default port is 3306.
Enter value -1 to use a named pipe connection.
Declare the MySqlClient connection:
C#:
using MySql.Data.MySqlClient;
MySqlConnection oMySqlConn = new MySqlConnection();
oMySqlConn.ConnectionString = "Server=Server;" +
"Database=Test;" +
"Uid=myUsername;Pwd=myPassword;";
oMySqlConn.Open();
VB.NET:
Imports MySql.Data.MySqlClient
Dim oMySqlConn As MySqlConnection = New _
MySqlConnection()
oMySqlConn.ConnectionString = "Server=Server;" & _
Database=Test;Uid=myUsername;Pwd=myPassword;"
oMySqlConn.Open()
MySqlConnection (.NET)
eInfoDesigns.dbProvider:
"Data Source=server;
Database=mydb;
User ID=myUsername;
Password=pwd;
Command Logging=false"
Note: This one is used with eInfoDesigns
dbProvider, an add-on to .NET Declare the
MySqlConnection:
C#:
using eInfoDesigns.dbProvider.MySqlClient;
MySqlConnection oMySqlConn = new MySqlConnection();
oMySqlConn.ConnectionString = "my connection string";
oMySqlConn.Open();
VB.NET:
Imports eInfoDesigns.dbProvider.MySqlClient
Dim oMySqlConn As MySqlConnection = New MySqlConnection()
oMySqlConn.ConnectionString = "my connection string"
oMySqlConn.Open()
SevenObjects MySqlClient (.NET)
Standard:
"Host=server;
UserName=myUsername;
Password=mypassword;
Database=mydb;"
Note: This is a freeware ADO.Net data provider from SevenObjects
Core Labs MySQLDirect (.NET)
CoreLabs MySQLDirect (.NET)
Standard:
"User ID=root;
Password=pwd;
Host=localhost;
Port=3306;
Database=test;
Direct=true;
Protocol=TCP;
Compress=false;
Pooling=true;
Min Pool Size=0;
Max Pool Size=100;
Connection Lifetime=0"