ODBC DSN
ODBC -- MyODBC Driver -- local database
ODBC -- MyODBC Driver -- remote database
ODBC -- MySQL ODBC 3.51 Driver
OleDb
.NET DataProvider from CoreLab
// ODBC DSN
using System.Data.Odbc;
OdbcConnection conn = new OdbcConnection();
conn.ConnectionString =
"Dsn=DsnName;" +
"Uid=UserName;" +
"Pwd=Secret;";
conn.Open();
// ODBC -- MyODBC Driver -- local database
using System.Data.Odbc;
OdbcConnection conn = new OdbcConnection();
conn.ConnectionString =
"Driver={MySql};" +
"Server=localhost;" +
"Option=16834;" +
"DataBase=DataBaseName;"
conn.Open();
// ODBC -- MyODBC Driver -- remote database
using System.Data.Odbc;
OdbcConnection conn = new OdbcConnection();
conn.ConnectionString =
"Driver={MySql};" +
"Server=db.domain.com;" +
"Option=131072;" +
"Port=3306;" +
"Stmt=;" +
"DataBase=DataBaseName;" +
"Uid=UserName;" +
"Pwd=Secret;"
conn.Open();
// ODBC -- MySQL ODBC 3.51 Driver
using System.Data.Odbc;
OdbcConnection conn = new OdbcConnection();
conn.ConnectionString =
"Driver={MySql ODBC 3.51 Driver};" +
"Server=ServerName;" +
"Option=16834;" +
"Port=3306;" +
"Stmt=;" +
"DataBase=DataBaseName;" +
"Uid=UserName;" +
"Pwd=Secret;"
conn.Open();
// or
using System.Data.Odbc;
OdbcConnection conn = new OdbcConnection();
conn.ConnectionString =
"DRIVER={MySql ODBC 3.51 Driver};" +
"SERVER=ServerName;" +
"DATABASE=DataBaseName;" +
"USER=UrerName;" +
"PASSWORD=Secret;"
conn.Open();
// OleDb
using System.Data.OleDb;
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString =
"Provider=MySqlProv;" +
"Data Source=ServerName;" +
"User id=UserName;" +
"Password=Secret;"
conn.Open();
// .NET DataProvider from CoreLab
using CoreLab.MySql;
MySqlConnection conn = new MySqlConnection();
conn.ConnectionString =
"Host=ServerName;" +
"DataBase=DataBaseName;" +
"Protocol=TCP;" +
"Port=3306;" +
"Direct=true;" +
"Compress=false;" +
"Pooling=true;" +
"Min Pool Size=0;" +
"Max Pool Size=100;" +
"Connection Lifetime=0;" +
"User id=UserName;" +
"Password=Secret;" +
conn.Open();