Azure and Dreamspark: Connecting your WebApp to your MySQL database
Previous Related Blog Next Related Blog
The Dreamspark MySQL database is a great opportunity to work with Web Apps, Web Jobs and a database on Azure cloud. This is completely free for students. Source item 1 shows you how to get connected to Dreamspark Azure.
Sources:
- Students: Claim your Free Microsoft Azure
- Getting MySql Running on Azure (from 2/9/2010)
- Microsoft offers free access to Azure web development services for students through 'Azure for Dreamspark'
- For an easier way to initially set-up your MySql database see the Next Related Blog
Discussion:
Because the Dreamspark Azure MySQL only allows 4 connections and stores up to 20 Megabytes, it is likely better if you use the file system in the WebApp and then a Web Job to load the data into your MySQL. As to the storage of images, you might need to have some sort of connection to the SkyDrive API, you would use the SkyDrive API in your Web Jobs. (FYI: I haven’t tried this yet.)
Many of the examples that I checked out use the “Classical” Azure Portal, but the Dreamspark Azure will only use the “New” portal. The process is somewhat different, and if you haven’t used the Classical portal it might be difficult to see the difference and the appearance might throw you off.
First off create a WebApp using one of the source material. Then create a MySQL database, you will need to be patient as the time to build the MySQL may be built in between instantly and a few minutes, be patient.
After a number of minutes in some cases and near instantly other times you will be able to click on the “all settings =>”, then properties and then copy the connection string, you will need it to connect your Web App to the MySQL database. This database will have no schema, that will be discussed in another blog. Copy the Connection String.
Now switch back to your web app, in this case, you need to open the blades by first clicking: “all settings” then “Application Settings”, scroll down till you see the “Connection String” button:
Once you have the “Connection Strings” button pushed, it is best if you select the dropdown box and pick MySQL.
Now give your MySQL database a name and paste in the connection string you put in earlier:
Your final result should look similar to the following, you “Name” and Connection String Value will look different of course.
Conclusion:
This blog shows you how to connect your Web App with the MySQL database provided by Dreamspark. To connect to other database systems, the processes are very similar.