locked
MySql Connector problem RRS feed

  • Question

  • User-1166428634 posted

    Hi All,

             I want to use MySQL 5.1 connector. But when i try to Add New Connection from Server Explorer MySql Database entry not display. Anybody knows this? How should i connect with it? 

    thanks

    Tuesday, February 28, 2012 7:11 AM

All replies

  • User665793701 posted
    1. Make sure you have installed the .Net Framework on your server 
    2. Download the ODBC .Net data provider and install it on your development machine or your server. You can download it here: http://www.microsoft.com/downloads/details.aspx?FamilyID=6ccd8427-1017-4f33-a062-d165078e32b1&DisplayLang=en
    3. install MySQL ODBC Driver-MyODBC 3.51. You can download it here: http://dev.mysql.com/downloads/connector/odbc/3.51.html 
    

    The ASP.NET code below connects to a MySQL database and displays all the records from Users table.

    <%@ Page CompilerOptions='/R:"C:\Program Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.dll"'%>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="Microsoft.Data.Odbc" %>
    Wednesday, February 29, 2012 12:37 AM
  • User-1043497454 posted

    I'm having similar issues. I've not used the DB connector features before but now that I upgraded to VS 2012 Express RC I wanted to try it out. I've tried both to get MS SQL Server working and MySQL (I think MS SQL Server installed along with VS 2012 but still I can't figure out how to connect to it or start it since that might be the issue)). Since this is the MySQL thread lets focus on that though.

    I have installed Connector/Net 6.5.4 and as per your advice I tried to also install the ODBC .Net data provider. I've added a reference, and still I don't get the option for MySQL as Data Source. Any ideas?

    Wednesday, July 18, 2012 5:19 AM
  • User831351949 posted
    In Web.Config pass the below code:
    
    <add name="MySQL_ODBC" connectionString="DRIVER={MySQL ODBC 3.51 Driver};SERVER=servername;DATABASE=databasename;UID=userID;PWD=urpassword;OPTION=3;" providerName="System.Data.Odbc"/>
    
    Please 'MARK AS ANSWER' if it helps

    Wednesday, July 18, 2012 5:29 AM
  • User814302705 posted

    When you say you added a reference, do you mean you went into Control Panel, Administrative Options, Data Sources and Add New?  IF not, then that would need to be done before it will populate in the above shown screen.

    Micheel3000

     

    Wednesday, July 18, 2012 6:43 AM
  • User455156504 posted

    Hi,

    I'm currently working with the MySQL/.NET connector and it works. You only have to install the connector - http://dev.mysql.com/downloads/connector/net/ - and it should be possible to connect to the database through the server explorer. A step-by-step guide could be found here - http://www.itcsolutions.eu/2010/09/09/how-to-connect-to-mysql-database-from-visual-studio-vs2010-problems-with-net-connectors/

    Wednesday, July 18, 2012 10:25 AM
  • User-1043497454 posted

    In Web.Config pass the below code:
    
    <add name="MySQL_ODBC" connectionString="DRIVER={MySQL ODBC 3.51 Driver};SERVER=servername;DATABASE=databasename;UID=userID;PWD=urpassword;OPTION=3;" providerName="System.Data.Odbc"/>
    
    Please 'MARK AS ANSWER' if it helps

    Thanks for your reply, but sadly it didn't work.

    When you say you added a reference, do you mean you went into Control Panel, Administrative Options, Data Sources and Add New?  IF not, then that would need to be done before it will populate in the above shown screen.

    Micheel3000

    Thanks for your reply. What I meant was adding a reference to MySql.Data in the project. Btw, I also tried to install this through NuGet with no luck.

    I tried to follow your advice, assuming you meant in the User DSN tab. There were 2 options for MS SQL Server (none for MySQL), but after picking either of them there's no server to chose from in the dropdown. I guess this means SQL Server is not running. If so, any clues as to how I start it? Or any clues as for why MySQL isn't shown there?

    I'm currently working with the MySQL/.NET connector and it works. You only have to install the connector - http://dev.mysql.com/downloads/connector/net/ - and it should be possible to connect to the database through the server explorer. A step-by-step guide could be found here - http://www.itcsolutions.eu/2010/09/09/how-to-connect-to-mysql-database-from-visual-studio-vs2010-problems-with-net-connectors/

    Thanks for your reply. That guide sadly didn't help. Perhaps because it's for VS2010, or perhaps because the issue it refers to relates to an older Connector?

    Wednesday, July 18, 2012 2:35 PM
  • User455156504 posted

    That guide sadly didn't help. Perhaps because it's for VS2010, or perhaps because the issue it refers to relates to an older Connector?

    What version of VS do you use? I have tested it in VS 2010 and it works fine with the latest version of the MySql/.NET connector.

    Wednesday, July 18, 2012 3:59 PM
  • User-1043497454 posted

    What version of VS do you use? I have tested it in VS 2010 and it works fine with the latest version of the MySql/.NET connector.

    As I wrote in my first post I use VS 2012 Express RC. I'm starting to think that might be the problem. I see now in the MySQL docs it doesn't meantion 2012. I guess I should give up on doing it this way then.

    Wednesday, July 18, 2012 5:10 PM