Microsoft’s cloud computing platform allows developers to leverage its database service, SQL Azure, amongst other Azure offerings. Applications can be developed which can use the cloud for database storage and querying.
While cloud-based database storage might sound difficult to implement, Microsoft has put in a lot of effort to ensure that the cloud application development experience remains similar to typical application development.
Let's walkthrough developing an application which uses SQL Azure.
Accessing your SQL Azure database from Azure portal
To get started, access the Windows Azure portal.
Click on Database on the bottom right corner.
As you can see, I have a SQL Azure account and in that account, I have one server provisioned. On that server, I have one database called “movies”. The “master” database comes with every SQL server. You can select a database, and click on the Manage button to navigate to the Database Manager.
You will have to enter your credentials to connect to the server. You can then manage your database through the web interface Database Manager provides which is powered by Silverlight. Alternately, you can use SQL Server Management Studio Express Edition to do the same.
Now, go ahead and create the necessary tables that you would want to use in your application.
Now we move to creating a web application which will call this database. Create a Web application and call it SQLAzureClientDemo. On the “Default” page, add a ListView and Configure its datasource to the SQL Azure database. Note that you will need to provide the FQDN of the database server as well as the user credentials for accessing the SQL Azure database. If you have issues configuring the ListView to bind to the SQL Azure database, you can download the attached source code to see how it is done in the project. Now, when you fire up the web application, it will connect to the SQL Azure database and show the data.
We can cross check that this information is coming from the SQL Azure database by looking at the Data view in the Database manager for the MovieList table in the Movies database.
In this article, we saw how to create a client application for accessing SQL Azure database. I hope you have found this information useful and you will use this to create interesting SQL Azure-based applications.
About the author
Vipul Patel is a Software Engineer currently working at Microsoft Corporation. He is currently working in the Microsoft Lync team and has worked in the .NET team earlier in the Base Class libraries and the Debugging and Profiling team. He can be reached at firstname.lastname@example.org