SQL Azure Reporting CTP
http://blogs.msdn.com/b/azchina/archive/2011/02/18/sql-azure-reporting-limited-ctp-arrived.a
概念
SQL Azure Reporting 把云端報表作為服務來提供,構建于SQL Server Reporting Services 和 SQL Azure 技術之上。諸如SQL Azure Reporting此類云端報表服務具有許多優勢,包括快速服務提供,成本效益,拓展性,高可用性以及減少報表服務器的管理費用,并能安全的訪問,查看和管理報表。SQL Azure Reporting?Service提供如下功能:
- § 在web應用和桌面應用中嵌入Visual Studio Report Viewer ADO.NET Ajax 控件或 Windows Form 控件來查看SQL Azure Reporting Service內的報表。
- § 各類應用都可以利用 SQL Azure Reporting SOAP API 來管理和獲取報表內容。
- § 使用SQL Azure Reporting Service Portal。
因為 SQL Azure Reporting Service構建于 SQL Server 2008 R2 Reporting Service之上,我們便可以使用熟悉的工具,例如SQL Server Integration Studio,Visual Studio Report Viewer等。SQL Azure Reporting Service其實是云端的遠程 SQL Server Reporting Service。
?
創建一個新的SQL Azure Reporting
打開Windows?Azure 開發者門戶,點擊左側導航欄的?Reporting 項。(如果還沒有激活碼, Sign Up 按鈕來發送申請。)點擊Provision 按鈕。
選擇同意服務條款,選擇訂購方式。此處我選擇Windows Azure Pass 訂購方案。
?
最后一部,復制邀請碼,輸入SQL Azure Reporting Service的密碼。用戶名會自動生成。
稍等之后,新的 SQL Azure Reporting Server以及Reporting Service URL 和用戶名都會顯示在門戶上。通過工具欄按鈕可以重置密碼。.
?
將報表部署至SQL Azure Reporting
如果您熟悉SQL Server Reporting Service,那么您會發現本章與本地的報表服務非常類似。首先,打開SQL Server Business Intelligence Development Studio ,創建新的Report Server Project。
創建一個共享數據源,報表數據便會從該數據源獲取。數據源應該選擇SQL Azure,但是此處也可以選擇 打開了端口的本地 SQL Server 或其他數據庫。此處,我選擇和報表服務位于同一數據中心的SQL Azure 數據庫 。 在 Credentials 標簽頁,輸入上文的用戶名和密碼。
?
SQL Azure Reporting CTP 只在北美數據中心內可用,所以最好選擇同一數據中心內的數據庫,避免外部傳輸費用。
創建一個簡單的報表,檢索回Members數據表的所有的記錄。在數據源選擇步驟,選擇之前的共享數據源。輸入 T-SQL語句來獲取數據。報表如下:
為了將報表部署至SQL Azure Reporting Service ,我們需要更新一下項目屬性。右擊項目,選擇屬性。在Target Server URL 項內,填入SQL Azure Reporting報表服務器的URL。回到開發者門戶,選擇左側的報表節點,復制Web Service URL ,并在URL最后填上 "/reportserver" 。
之后,點擊項目的 Deploy 菜單項, Visual Studio會編譯報表服務,并上傳至報表服務。這一步,會提示需要輸入SQL Azure Reporting Service 的用戶名和密碼。大約一分鐘后,報表并會部署成功。?
在瀏覽器中查看報表
SQL Azure Reporting 允許我們在瀏覽器中查看云端部署的報表。我們輸入Web Service URL ,同樣在最后填上 "/reportserver" 路徑,并以 HTTPS 協議打開,我們便能看到SQL Azure Reporting Service 登陸頁面。
輸入用戶名和密碼,可以看到目錄和報表清單。選擇報表, Report Viewer 便會開始生成報表。
?
通過Report Viewer 在Web Role內查看報表
?ASP.NET 和 Windows Form Report Viewer 一樣能夠用于查看SQL Azure Reporting Service 。我們可以創建一個ASP.NET Web Role ,添加Report Viewer 控件,所需的更改如下:
- § 將Processing Mode 改為 Remote。
- § 將Server Remote目錄下的 Report Server URL 設為上文SQL Azure Reporting Web Service URL 并加上 "/reportserver"路徑。
- § 將 Report Path 設為我們希望顯示的路徑。報表名不應該包含拓展名。舉例, SqlAzureReportingTest 項目中名為MemberList.rdl 的報表,那么路徑應為/SqlAzureReportingTest/MemberList。
下一步輸入SQL Azure Reporting Credentials。我們用一下類來封裝報表服務器憑證。
private?class?ReportServerCredentials : IReportServerCredentials
{
????private?string _userName;
????private?string _password;
????private?string _domain;
?
????public?ReportServerCredentials(string userName, string password, string domain)
????{
????????_userName = userName;
????????_password = password;
????????_domain = domain;
????}
?
????public?WindowsIdentity ImpersonationUser
????{
????????get
????????{
????????????return?null;
????????}
????}
?
????public?ICredentials NetworkCredentials
????{
????????get
????????{
????????????return?null;
????????}
????}
?
????public?bool?GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority)
????{
????????authCookie = null;
????????user = _userName;
????????password = _password;
????????authority = _domain;
????????return?true;
????}
}
在 Page_Load 方法內,將其傳遞給 report viewer。
protected?void?Page_Load(object sender, EventArgs e)
{
????ReportViewer1.ServerReport.ReportServerCredentials =?new?ReportServerCredentials(
????????"<user name>",
????????"<password>",
????????"<sql azure reporting web service url>");
}
最后部署至 Windows Azure 效果如下:
?
總結
本文介紹了SQL Azure Reporting CTP 。和其他Windows Azure特性一樣, SQL Azure Reporting 與SQL Server Reporting非常相似。我們可以使用現有熟悉的工具來構建,部署以及顯示報表。SQL Azure Reporting仍然出于 CTP 階段,這意味著:
?
- § 免費。
- § 沒有技術支持。
- § 只能用 北美數據中心
通過如下鏈接獲得更多信息:
- §?SQL Azure Reporting Limited CTP at MSDN
- §?SQL Azure Reporting Samples at TechNet Wiki
本文翻譯自:http://geekswithblogs.net/shaunxu/archive/2011/02/17/sql-azure-reporting-limited-ctp-arrived.aspx
?
轉載于:https://www.cnblogs.com/RobotTech/archive/2012/03/07/2383852.html
總結
以上是生活随笔為你收集整理的SQL Azure Reporting CTP的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 有关转换问题
- 下一篇: 代码优化从数据库里查数据