Harshdeep Singh
Harshdeep Singh

Reputation: 93

MySQL Connecting string using ODBC drivers

I am uploading a ASP.NET website which us MySQL as database and I am not able to open a connection to database on my server. The website was working fine on localhost but on server it throws an exception:

The server is provided with MySQL ODBC 5.0 drivers as they say. Connection string I am using is:

connectionString="driver={MySQL ODBC 5.1 Driver};Server=(local); Database=db_name; Connection Timeout=60; uid=username;pwd=1234;"

Is this the correct way of connecting to database?

Upvotes: 1

Views: 12401

Answers (3)

philwilks
philwilks

Reputation: 669

The server is provided with MySQL ODBC 5.0 drivers as they say

You're using the 5.1 driver in your connection string - have you tried changing this to 5.0?

Upvotes: 0

Qqbt
Qqbt

Reputation: 812

Try this (if you havnt checked out the link):

connectionString = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=myDataBase; User=myUsername;Password=myPassword;Option=3;"

Upvotes: 3

Qqbt
Qqbt

Reputation: 812

You can check out several connection strings for MySQL with ODBC drivers at:

www.connectionstrings.com/mysql#p31

Upvotes: 1

Related Questions