MySQL database connectivity

  • Thread starter Thread starter Steven Caliendo
  • Start date Start date
S

Steven Caliendo

Hi,

I have a MySQL database on a remote server that I need to connect to. I
can't seem to figure out what the connectionstring should be? I've searched
through the help files, but all I can find is information for SQL server.

Thanks,

Steve
 
That's right you need to install myOdbc on the webserver (from
www.mysql.com)
Then use a connection string like

driver={MySQL ODBC 3.51
Driver};server=127.0.0.1;uid=yourUsername;pwd=yourPassword;database=yourData
base;OPTION=16834;
or
driver={MySQL};server=127.0.0.1;uid=yourUsername;pwd=yourPassword;database=y
ourDatabase;OPTION=16834;

depending on the myodbc version

I have used Microsoft.Data.Odbc to access the db in .net version 1.0 (you
have to download this too)
or System.Data.Odbc if you are using version .net 1.1 (included in 1.1
framework)

HTH
 
I've had great luck with ByteFX's MySQL data provider library, check it out at:
http://www.bytefx.com/dotdata.aspx


After that, connection is as easy as:
string connstrg = "Server=localhost;Database=mydatabase;User
ID=myuserid;Password=mypassword";
m_dbconn = new MySqlConnection(connstrg);
m_dbconn.Open();

dryer
 
Back
Top