Freigeben über


Retrieving MySQL connection string from Windows Azure Web Sites aka ANTARES

In my previous post, click here, I mentioned and described few of the features of WAWS, cloud offering from Microsoft. As I mentioned we could associate a application with either the MySQL db or Microsoft’s own SQL Server db. There is a small twist in the story though. MySQL is owned by ClearDB and there is no UI on Windows Azure to manage MySQL db.

Windows Azure has a web interface/UI for managing SQL Server db. Here is a snapshot of the same:

image

Windows Azure portal for managing SQL Server databases

Last week, one of the consumers of the Windows Azure wanted to know how to retrieve the MySQL connection string so that he could use it with other application that he had on Azure. This could get tricky. As I said earlier, there is no UI for managing MySQL database. So the question is how does one retrieve the connection string if he wishes to.

Before I proceed ahead on how to retrieve the connection string let me show you how do you create a MySQL db on Windows Azure.

Creating a MySQL db on Windows Azure Web Sites

  • Go to WEB SITES and click on NEW.
  • Select COMPUTE and then WEB SITE and then click on CUSTOM CREATE.

image

  • This will show up another portal where you will get the following options
    • Chose the URL for the Web Site.
    • Chose the subscription you want to use, in case you have more than one.
    • The geographical location where you want this to be created.
    • Create either a new SQL Server or MySQL db or chose from the existing one.

image

      • Once you have created or selected the database, you will see the DB CONNECTION STRING NAME. This can be edited.

image

      • Click on image to confirm the creation of both the site and the database.

So I created a site (kaushal-mysql) to use a MySQL database successfully. Now lets proceed to the next step where we can retrieve/view the connection string.

Retrieving/Viewing the MySQL Connection String

In order to be able to the view the connection string the MySQL Db should be linked to the site i.e., if you go to the LINKED RESOURCES section then you should see that the corresponding MySQL db.

  • Click on WEB SITES.
  • Click on the site which is using the MySQL db. In my case it is kaushal-mysql.
  • Click on DASHBOARD.
  • Towards the RHS of the portal under quick glance you will see the option “View connection strings. ” Click on this to view the connection string.

image

There you go! Here is the MySQL connection string that you were looking for. Obviously this will also show the SQL Server connection string in case the site was created with a SQL Server db.

NOTE: If the MySQL database is unlinked then clicking on “View connection strings.” will not display anything.

 

image

So ensure that the database is linked to the site in order to view the connection string. Once you have copied the connection string. You could unlink and use that connection string in another application.

That's it for today folks. Hope this helps someone. Until then ciao! Smile