by Daniel Jebaraj Scale to Cloud Reporting with Azure and Syncfusion’s RDL Report Viewer In 30 minutes or less
by Daniel Jebaraj
Scale to Cloud Reporting
with Azure and
Syncfusion’s RDL Report
Viewer In 30 minutes or less
Syncfusion | Contents 2
Contents
Goals .................................................................................................................................................................................... 3
Background ....................................................................................................................................................................... 3
SQL Azure ...................................................................................................................................................................... 3
SQL Azure Reporting (preview as of February 2012) .................................................................................... 3
Syncfusion’s Reporting Solution—A little history ............................................................................................... 4
Before We Get Started—System requirements ................................................................................................... 5
Create a New SQL Azure Reporting Server ........................................................................................................... 5
Create a new SQL Azure server .................................................................................................................................. 8
Import data from the Northwind database ................................................................................................... 10
Optional step—export your own data to SQL Azure ................................................................................. 10
Import data into SQL Azure ................................................................................................................................. 13
Configure a shared data source inside the reporting server .................................................................. 14
Use Microsoft Report Builder to build the report ....................................................................................... 16
Viewing SQL Azure report from your WPF or Silverlight application .................................................. 19
Summary ......................................................................................................................................................................... 20
Syncfusion | Goals 3
Goals
This white paper will walk through the creation of a complete SQL Azure report from
scratch.
It will then deploy the report and visualize it in a WPF application.
The steps are quite detailed for completeness. Please feel free to skip sections that are
not applicable to your needs.
No prior knowledge of Windows Azure is assumed.
Background
Cloud computing brings with it the promise of scalable and easy-to-manage services. Windows
Azure is Microsoft’s entry in this arena. It is a very credible entry that packs powerful features
such as a relational data store. As with all Microsoft products, the management and
development infrastructure is also very good with an excellent set of tools being available to
support development and deployment. For our current purpose, two of these services are of
interest—SQL Azure and SQL Azure Reporting.
SQL Azure SQL Azure is a full-fledged relational database engine in the cloud that can be administered with
standard Microsoft tools such as SQL Server Management Studio. The only thing missing from
SQL Azure other than a few rarely used features (http://msdn.microsoft.com/en-
us/library/windowsazure/ee336245.aspx) is the headache associated with managing production
servers. With SQL Azure, you have access to database features such as triggers, views, stored
procedures, and indexes.
SQL Azure Database provides two database editions: Web Edition and Business Edition. Web
Edition databases can grow up to a size of 5 GB and Business Edition databases can grow up to
a size of 150 GB. You can host up to 149 databases on each SQL Azure server.
SQL Azure Reporting (preview as of February 2012) Microsoft announced a groundbreaking product during Q4 of 2011—a preview version of an
enterprise reporting product named SQL Azure Reporting. SQL Azure Reporting is modeled on
SQL Server Reporting Services.
Syncfusion | Syncfusion’s Reporting Solution—A little history 4
While SQL Server Reporting Services has been available for years within SQL Server, it took effort
and management overhead to install and maintain. For that reason, while very popular in
environments that had the IT staff and infrastructure required, it was not very commonly used in
smaller and mid-sized environments. Smaller and mid-size markets are currently dominated by
rather poorly designed, inflexible proprietary solutions.
SQL Azure Reporting is set to change this in a big way. The ease with which SQL Azure
Reporting can be deployed is quite amazing. You can create a report server and go live with
your reports in less than 30 minutes. In addition, SQL Azure Reporting provides the benefits
associated with the cloud—scalability, high availability and vastly reduced management
overhead. You can also rest assured that your reports are stored in an open format backed by
multiple vendors instead of a proprietary format that may or may not be supported in the long
run and on future platforms.
Additional information on SQL Azure Reporting is available here: http://msdn.microsoft.com/en-
us/library/windowsazure/gg430132.aspx.
Syncfusion’s Reporting Solution—A little history
Several years ago when Syncfusion was looking into building a reporting product, we
considered several options including building our own proprietary reporting solution. Building a
proprietary solution would have given us a lot of flexibility in using technology we saw fit. It
would have dramatically cut down the time to market since we would not have had to work on
implementing every aspect of a detailed specification.
While most third-party reporting vendors chose to go in this direction, we decided that this was
not the right thing to do for our customers. We firmly believed that data and reports need to be
available in documented and open formats since data outlives most applications. 10 or 20 years
down the line, it will still be important to have access to data in its original format complete with
reports that were prepared for studying it at that time. Using a proprietary solution would have
meant giving up on this core premise.
Instead, we resolved to build a set of reporting products that would work strictly based on open
formats. We took years to bring some of these products to market since the formats were
complex and involved a lot of hard work.
Little did we know then that this journey would take a decade. Today, we are proud that we ship
the largest reporting suite on the .NET platform. Our Excel, Word, and PDF libraries are used by
Syncfusion | Before We Get Started—System requirements 5
thousands of customers to generate complex documents to exacting standards on a very large
scale.
In addition to the file format based reporting products, we have also been working on a Report
Definition Language (RDL)-based reporting engine that will offer a true WYSIWYG editing and
production experience for reports. Our RDL-based reporting product has been updated several
times over the past 3 years, and with Syncfusion Essential Studio 2012 Volume 1 we were excited
to announce a version that we consider ready for most enterprise reporting needs.
This product is unique in the .NET reporting market since it is the only reporting system that is
built end-to-end on open standards. As a direct consequence of being built on RDL, it is also the
first and only third-party reporting solution to support SQL Azure Reporting (SQL Azure
Reporting also uses RDL as its native format).
Before We Get Started—System requirements
Access to Windows Azure services. If you are an MSDN subscriber, you can activate
Windows Azure services from within your MSDN account. Alternatively you may sign up
for an account at http://windows.azure.com.
Microsoft SQL Server 2008 R2 Report Builder 3.0, available from
http://www.microsoft.com/download/en/details.aspx?id=6116.
SQL Server Management Studio installed with Microsoft SQL Server 2008 R2. If you do
not have it installed, SQL Server Express Edition with management tools is available from
http://www.microsoft.com/sqlserver/en/us/editions/express.aspx.
The latest version of Syncfusion Essential Studio. If you do not have the full version
installed you may download a free trial from
http://www.syncfusion.com/downloads/evaluation.
The use of LINQPad from http://www.linqpad.net/ is optional. We will use LINQPad for
running test queries. SQL Server Management Studio may also be used for this purpose.
Create a New SQL Azure Reporting Server
Sign in to the Windows Azure portal available at https://windows.azure.com/.
Click on the “Reporting” option listed on the shortcut bar displayed in the left side of the
portal view.
Syncfusion | Create a New SQL Azure Reporting Server 6
Create a new SQL Azure Reporting server link. You will then be prompted to fill in details
on the region where your server instance will be located. Pick a location that will work for
your needs.
Syncfusion | Create a New SQL Azure Reporting Server 7
The final step is to assign a user name and password for the server’s administrator
account.
o Note: SQL Azure Reporting does not allow the administrator account to be
named administrator.
After you are done with the wizard you should have a view similar to the view below. You may
have to expand your Subscriptions tree node on the left to see status information on the server
instance that you just created.
Syncfusion | Create a new SQL Azure server 8
Create a new SQL Azure server
Now select the Database section and create a SQL Azure server.
Syncfusion | Create a new SQL Azure server 9
The steps are similar to the steps used to create the reporting server with one important
exception. You will have to additionally configure firewall rules. There are at least two
firewall rules that need to be configured.
When the firewall rules configuration dialog is displayed, selecting the Allow other
Windows Azure services to access this server checkbox will add a special rule with IP
address 0.0.0.0.
o This rule is required for any Azure service, even the included database manager
utility or the Reporting Server instances within Azure to be able to connect to the
SQL Azure database.
Additionally for development purposes you need to provide access to the IP address that
you are working from. If you click the Add button, a dialog will pop up displaying your
current external IP address. You will need to add this also to allow access to SQL Azure
through development tools available on your system.
o Please note that if you are behind a dynamic IP address you may have to change
this setting each time your IP address changes.
o It is also possible that you will want to provide access to a block of IP addresses if
you work for an organization that has a pre-assigned block.
o Without this rule access to the SQL Azure system, tools such as LINQPad or SQL
Server Management Studio will not work.
Syncfusion | Create a new SQL Azure server 10
Import data from the Northwind database Now that you have created your database and reporting server, go ahead and import data into
the SQL Azure database server.
Create a new database by clicking the Create button. Call it Northwind. A SQL Azure
compatible script with just the Northwind tables is available at the Bitbucket location
linked below.
https://bitbucket.org/danjebaraj/syncfusion-samples/src
Optional step—export your own data to SQL Azure Instead of using the provided Northwind script, you can also export any current database as a
SQL Azure compatible script using SQL Server Management Studio.
The steps given below are for SQL Server Management Studio 2008 R2.
Select the name of the database whose script you would like to generate. Right-click and
then select “Tasks…Generate Scripts” as shown below.
Syncfusion | Create a new SQL Azure server 11
The wizard that is displayed contains introductory information. You can skip the first
page.
The second page allows you to export all objects or selected ones. You can change these
settings in accordance with your needs. For our purposes, we will only generate table
information.
When the next step is displayed, click the Advanced button.
Syncfusion | Create a new SQL Azure server 12
In the advanced settings dialog that is displayed, the two settings that need to be
changed are marked in the image below.
Note: The generated file appears to contain settings for UNCLUSTERED keys. These are not
supported under SQL Azure. We need to go through and change the keys to CLUSTERED in
order for the schema and data to be successfully imported into SQL Azure.
Syncfusion | Create a new SQL Azure server 13
Correct format example
CONSTRAINT [PK_Suppliers] PRIMARY KEY CLUSTERED
Import data into SQL Azure The final step is to complete the import. You can use LINQPad for this, but SQL Server
Management Studio should work equally well for your needs.
Copy the Fully Qualified DNS Name of the SQL Azure server instance.
With LINQPad, click Add connection, select the LINQ to SQL driver and then the
settings marked in the image below.
Syncfusion | Create a new SQL Azure server 14
You can then click the Test button to validate that all is set up properly. After you have
added a connection to the server, go ahead and create a new query window and select
the Northwind database reference from the Database drop-down list.
Note: SQL Azure does not support switching contexts with the USE statement. You will have to
explicitly select the database against which the query is to be executed as shown below.
Run the script that you obtained earlier to import data and schema into the Northwind
database. If all goes well you should see a confirmation message.
Configure a shared data source inside the reporting server We now have to configure a shared data source whose metadata can be consumed to produce
a report. Detailed steps are given below.
Click on the Create Data Source button.
Syncfusion | Create a new SQL Azure server 15
Obtain the connection string from the database server.
Use the connection string and credential information to create a shared data source.
Note: Remove the password setting from the copied connection string. We will provide the
password separately under the Connect using: section as shown in the following screenshot.
Syncfusion | Create a new SQL Azure server 16
Use Microsoft Report Builder to build the report We are now ready to build our report.
You can now open the Report Builder tool that you would have installed earlier.
When Report Builder comes up it displays a wizard interface. We can simply select the
Blank report option and then close the wizard.
The next step is to connect our new report to the SQL Azure Reporting Server instance
we had created earlier.
Syncfusion | Create a new SQL Azure server 17
The next step is to configure a data source for our report. Right-click the Data Sources
entry under the Report Data window.
Click the Add data source option that will be displayed. A wizard will then be displayed.
Select the Use a shared connection or report model option and then click Browse to
select the shared data source that we created earlier on the SQL Azure Reporting server.
Now that we have a data source, we can create a dataset. Right-click on the Datasets
entry under the Report Model window. Select the Add a dataset option that is
displayed. Apply the settings shown below. We used the query designer to build a simple
query that selects all customers in the Northwind database’s “Customers” table.
Syncfusion | Create a new SQL Azure server 18
The next step is to design the structure of the report and save it on the server.
Insert a table and add fields to it by dragging and dropping from the dataset that we just
created. The resulting report should be similar to the report shown below.
We can now go ahead and save the report. We will be prompted for a name and the
report will be stored on the SQL Azure Reporting server.
You can now click on the Run option within the Report Builder to preview the report.
After this you can exit the Report Builder application.
Our report is complete and has been deployed to a reporting server instance.
Syncfusion | Create a new SQL Azure server 19
Viewing SQL Azure report from your WPF or Silverlight
application Please download the WPF RDL viewer sample available from the link below.
https://bitbucket.org/danjebaraj/syncfusion-samples/src
Please note that you will need to have a full or evaluation version of Syncfusion Essential Studio
(Enterprise or Reporting Edition) 2012 Volume 1 or later installed on your machine in order to
build this sample.
Open app.config and change the settings below to values that pertain to your server
instance.
<appSettings> <add key="user" value="report-user-name"/> <add key="password" value="report-password"/> <add key="db-user" value="db-user-name"/> <add key="db-password" value="db-user-password"/> <add key="reportServerUrl" value="https://report-server-name.reporting.windows.net/reportserver"/> <add key="reportFileName" value="/report-name-or-path"/> </appSettings>
Note: One aspect to note is that the report is being rendered locally on the client system. Data
and schema information for the report come from the server. The report viewer is not using the
server for rendering purposes.
Since the rendering is being accomplished on the client system, you will have to
separately pass in credentials (db-user-name and db-password) for the SQL Azure data
source in addition to credentials for the SQL Azure report itself (report-user-name and
report-password settings).
Build and run the project. You should see a screen similar to the one shown below.
Syncfusion | Summary 20
There is not much code in the sample. The report viewer does most of the work. The only
code we write is to set the credentials for the report and database instances.
That is all there is to it. A Silverlight sample may already be available by the time you read this,
but if it is not please check back at the same Bitbucket location in a couple of days. We will be
adding it shortly.
Summary
Cloud-based reporting with SQL Azure Reporting is a powerful way to produce and deploy
reports in a seamless manner. Microsoft provides viewers for Windows Forms and ASP.NET.
Syncfusion adds viewers1 for Silverlight and WPF, making it possible to natively integrate SQL
Azure reports into your Silverlight and WPF projects.
1 Syncfusion also provides RDL rendering systems for RDLC files that operate purely on the client with no need to
access a reporting server instance.