Data Driver

Blog archive

Acing Azure and Dabbling in Dallas

Got Azure? I do!

Here's a ringing endorsement for the simplicity of the Windows Azure platform: I was able to migrate a database into a SQL Azure project and display its data in an ASP.NET Web page. What's more, I actually developed a Windows Forms application that displayed some of the vast store of public data accessible via Microsoft's Dallas project.

And believe me, if I can do it, anybody who knows what a connection string is can do it. It's wicked easy, as they say here in the Boston area.

I've long been fascinated by the cloud. In fact, almost exactly three years ago I commissioned an article on the nascent technology, having identified it as the future of... well, just about everything. For me, a coding dilettante, there's just something cool about the novelty of being in the cloud. For IT pros, it must be exciting having no worries about hardware, the nitty gritty of administration minutiae, and so on.

So if you haven't yet, you should check out the cloud. Microsoft's Windows Azure platform services are free until Feb. 1.

Here's how I did it. I used a laptop running Windows 7, with Visual Studio 2010 Beta 2, SQL Server Management Studio, SQL Server Express, the Windows Azure SDK, the Windows Azure Toolkit for Visual Studio 2010, and the Windows Azure Platform Training Kit.

To start out, I asked our friends in Redmond for a SQL Azure October CTP invitation through Microsoft Connect. This just involved signing in with a Windows Live ID and answering a few questions. The invitation code e-mail arrived in a few days. I went to the SQL Azure management portal, entered my invitation code, provided an administrator user name and password, created an AppFabric, a new Service Namespace and validated the name, created an account and started my first project.


[Click on image for larger view.]

Clicking on the Firewall Settings tab lets you specify a range of IP addresses that can access your project. And there's a checkbox to allow Microsoft services to access the box.

After passing a Database Connectivity Test, I was off to SQL Server Management Studio (SSMO) to start playing around in the cloud. You can create a database schema from the portal, but to populate it I used SSMO. It was easy to create a simple database and run queries against it using Transact-SQL, after I learned you had to provide a clustered index.


[Click on image for larger view.]

The only catch to remember is that when starting up SSMO, you need to close out of the initial Connect to Server box that pops up, for some reason. Then you need to click on New Query and enter your SQL Azure server name in the same exact dialog box. The server name is handily provided via the portal, where you can also get your connection strings by selecting the database you want to work with and clicking on "Connection Strings" and choosing ADO.NET or ODBC. Here's a snapshot of a database list and the accompanying functionality provided by the portal:


[Click on image for larger view.]

After creating a simple database and populating it, I moved on to the more complicated project of migrating an existing database to SQL Azure, which presently doesn't handle some common data types and functions.

Luckily, Microsoft provides a handy SQL Azure Migration Wizard, which I got to work after a few hiccups. You can see all the different conversion options it offers here:


[Click on image for larger view.]

I also created the sample database ("School.mdf") from this tutorial explaining how to migrate databases via Transact-SQL scripts.

Here's what a failed script looks like:


[Click on image for larger view.]

Here's what a successful script looks like:


[Click on image for larger view.]

From there I tackled the task of using Visual Studio to build some apps to access the SQL Azure databases. I created a console app, a Windows Form app, and an ASP.NET page with data displayed via GridView and more. I then secured a Dallas account and started displaying public information like news feeds, crime statistics and more from a vast repository of public information. Being a rank amateur, it took me much longer than I care to admit. I'll give you some of the gory details and maybe a few helpful tips on what not to do later.

In the meantime, if you've dabbled in Dallas and have something cool to share, tell us about it -- and provide a link if possible -- in the comments section below, or drop me a line at [email protected]. I would love to find out what's going on out there in this new playground in the sky.

Posted by David Ramel on 12/16/2009


comments powered by Disqus

Featured

Subscribe on YouTube