Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
In 30 minutes or less
by Daniel Jebaraj
Contents
Goals .................................................................................................................................................................................... 3 Background ....................................................................................................................................................................... 3 SQL Azure ...................................................................................................................................................................... 3 SQL Azure Reporting (preview as of February 2012) .................................................................................... 3 Syncfusions Reporting SolutionA little history ............................................................................................... 4 Before We Get StartedSystem 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 stepexport 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 | Contents
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 Microsofts 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 interestSQL 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/enus/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.
Syncfusion | Goals
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 cloudscalability, 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/enus/library/windowsazure/gg430132.aspx.
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).
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.
The final step is to assign a user name and password for the servers 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.
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 o 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. 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. Without this rule access to the SQL Azure system, tools such as LINQPad or SQL Server Management Studio will not work.
10
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.
11
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 12
With LINQPad, click Add connection, select the LINQ to SQL driver and then the settings marked in the image below.
13
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.
14
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.
15
The next step is to connect our new report to the SQL Azure Reporting Server instance we had created earlier.
16
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 databases Customers table.
17
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 18
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.
19
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.
Syncfusion also provides RDL rendering systems for RDLC files that operate purely on the client with no need to
Syncfusion | Summary
20
With SQL Azure and SQL Azure Reporting, world-class reporting is now within the grasp of most organizations without regard to the size of their IT team. We firmly believe that SQL Azure Reporting is a remarkable product that will change how reports are prepared and consumed.
Syncfusion |
21