locked
Classic ASP site on Azure web site, how to connecto to VM MySQLdatabase RRS feed

  • Question

  • I have copied a classic asp website to the a Azure websites, and was trying to get it to connect to a MySQL database (either on a VM within Azure, or a remote one not hosted on Azure).  I am getting a internal server error message, and the detailed logs seem to point to an issue with my connection string.

    The current string is setup as below:

    database_string = "Driver={mySQL ODBC 5.1 Driver}; Server=server.com; Port=3306; Option=0; Socket=; Stmt=; Database=mydb; Uid=user; Pwd=password;"
    
    'and the ADODB connection is setup like such;
    Set area_rec = Server.CreateObject("ADODB.Recordset")
    area_rec.ActiveConnection = database_string 
    

    I am having a hard time seeing the specific error, but a couple questions if anyone could provide some guidance.

      • Is the connection string correct?  What dtabase driver should I be using for Azure (ODBC currenty)?
      • I currently have it set as an include within the ASP page being called.  Does it need to be setup differently for Azure websites?
      • Any other issues with using this structure (e.g. adodb recordsets)
      • Are remote databases are supportable in the first place?
      • Do I need to setup a linked resource?

    Thank you much for any help, I have struggled with this for a while.


    Tuesday, October 2, 2012 1:27 PM

Answers

  • We don't support connecting to MySQL with legacy ASP. We do support connecting using ASP.NET.


    Jim Cheshire | Microsoft

    Tuesday, December 11, 2012 1:45 PM

All replies

  • Hi jlbrace,

    From your description ,it seems to be an Azure Iaas problem, I ‘d like to move this post to the most related forum .

    There are many experts , so you will get  better support  and  may have more luck getting answers .

    Thanks for your understanding .

    Regards

    Wednesday, October 3, 2012 6:57 AM
  • You'll have to use a MySQL database created in the portal and managed by ClearDB. (They provide MySQL hosting for Windows Azure Web Sites.) Once you do that, it will be a linked resource on your site and you can find a connection string using the View Connection Strings link in the portal.


    Jim Cheshire | Microsoft

    Friday, October 5, 2012 7:22 PM
  • So, for Azure Websites, no databases that are not either SQL Azure, or MySQL through ClearDB/portal?

    And if I need to use a different MySQL db, then either run the ASP site on a Virtual Machine, or a Web Role, I presume.

    Thanks again for the help.


    JB

    Friday, October 5, 2012 7:50 PM
  • Yep, that's right. If you're using Azure Web Sites, MySQL hosting is provided by ClearDB. If you want to install your own MySQL server, you'd need your own VM.


    Jim Cheshire | Microsoft

    Friday, October 5, 2012 10:07 PM
  • Ok, so I have the MySQL database setup through ClearDB (linked on this site), the connection string being listed from the portal as such:

    Database=db;Data Source=us-cdbr-azure-east-b.cloudapp.net;User Id=longuserid;Password=randpw

    I am still struggling to set a valid connection string that can use this database.  I have tried the following interations...

    Database_str = "Driver={MySQL ODBC 5.1 Driver}; Server=us-cdbr-azure-east-b.cloudapp.net; Port=3306; Option=3; Database=db; Uid=longuserid; Pwd=randpw;"
    Database_str="Database=db; Data Source=us-cdbr-azure-east-b.cloudapp.net; User Id=longuserid;Password=randpw"
    
    Dim area_rec
    
    Set area_rec = Server.CreateObject("ADODB.Recordset")
    area_rec.ActiveConnection = Database_str

    The error in the detailed log is continually

    [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

    or once telling me the data source name was too long, when using the second option above.

    If you had a working example of a connection string for classic asp in this environment, I would be much obliged.


    JB

    Saturday, October 6, 2012 12:08 PM
  • Did you ever find an answer to this?  I'm hitting the same issue myself.
    Saturday, December 8, 2012 3:43 PM
  • No, I did not come up with a valid connection method for classic ASP to a MySQL db on ClearDB.  If you do run across an answer, I am all ears.

    I ended up creating a virtual machine, and hosting the classic ASP files on there, easily connecting to ClearDB (or any MySQL db).  I would prefer to use Azure websites, but never got over the hump with this.


    JB

    Monday, December 10, 2012 2:56 PM
  • We don't support connecting to MySQL with legacy ASP. We do support connecting using ASP.NET.


    Jim Cheshire | Microsoft

    Tuesday, December 11, 2012 1:45 PM