Presentation is loading. Please wait.

Presentation is loading. Please wait.

Publishing Your PDB Under Windows Jim Quigley conEdison.

Similar presentations

Presentation on theme: "Publishing Your PDB Under Windows Jim Quigley conEdison."— Presentation transcript:

1 Publishing Your PDB Under Windows Jim Quigley conEdison


3 Introduction Tutorial How to publish the contents of a database using features available in Microsoft Windows Local machine Legacy client/server Intranet/Internet

4 Introduction Might be a little bit heavy on the VB/ HTML side for old-time capacity planners... Vic Soder, CMG ERB If you have ever written a COBOL program, you are overqualified for web development.

5 Disclaimer All products mentioned are the property of their owners It may possible to use these technologies to publish data in ways that were not intended, or that have licensing implications

6 Agenda Scripting Data Access Methods Overview Configuration Issues Sample Scripts ActiveX Controls Overview Sample Scripts Office Web Components

7 Scripting

8 Script is the glue Vbscript and Jscript Legacy Windows WSH – Windows Scripting Host Browser Client-side and Server-side

9 Scripting SAS SQL Server Access Window Browser MDACMDAC Script ACTIVEXACTIVEX

10 MDAC Microsoft Data Access Components

11 MDAC Universal Data Access 1) ODBC – Open Database Connectivity 2) OLE DB – OLE Database 3) ADO – Active Data Objects 4) RDS – Remote Data Services 5) ADO.Net - ???


13 ODBC Circa 1990 Ubiquitous drivers Not an Object-Oriented API Relational bias

14 OLE DB COM interface Support for broader spectrum of data repositories Interface used by ADO ODBC data sources accessible via MS OLE DB provider for ODBC Possibly with reduced function

15 ADO (currently) Highest level interface Simplified object structure Relies on OLE DB

16 RDS Makes ADO data sources accessible across a network HTTP, HTTPS, or DCOM Uses Microsoft Internet Information Server as conduit

17 RDS

18 MDAC Configuration Issues

19 ODBC Data Sources Control Panel Administrative Tools Data Sources (ODBC) SAS ODBC Drivers System Data Source TCP Port c:\WINNT\system32\drivers\etc\services

20 SAS TCP Port

21 SAS ODBC vs. OLE DB ODBC Separate install Full SQL support Runs Proc OdbcServ instance Field name is variable label OLE DB Auto install with V8 SQL not supported Direct lib/member access Field name is variable name

22 MSDFMAP.ini RDS Security C:\WinNT\System\MSDFMAP.ini Create token to identify local data source for remote access Determine permitted access

23 MSDFMAP.ini

24 [connect default] Access=NoAccess [sql default] ;Sql=" ' <---comment this line out [connect PDB] Access=ReadOnly Connect="Provider=sas.LocalProvider.1; Data Source=d:\PDB\Detail\ [connect SasRemote] Access=ReadOnly Connect="Data Source=SasLocal"

25 Other RDS/IIS Issues IIS uses IWAM-servername as proxy (Launch IIS Process Account) WQExxxxx.TRC diagnostics Recommendations (SAS) ODBC – Start Proc OdbcServ manually OLE DB – give IWAM-servername read permission to PDB

26 MDAC Interfaces

27 ADO Objects

28 RecordSet Object Set rs = CreateObject(ADODB.Recordset) Methods rs.Open, rs.Close rs.MoveFirst, Rs.MoveNext Properties rs.BOF, rs.EOF rs.Connection

29 Field Object Fields collection contains Field objects, one for each column in the table rs.Fields.Count – number of columns rs.Fields(x).Value - value rs.Fields(x).Name – label

30 Warning Code to Follow

31 ADO Script - WSH Set rs = CreateObject(ADODB.Recordset) ConnectionString = DSN=SasLocal Sql = Select PCTCPUTM from PDB.System rs.Open Sql, ConnectionString While Not rs.EOF Msg = Msg + CStr(rs.Fields(0).Value) + vbCrLf rs.MoveNext end MsgBox Msg D:\Cmg2000\AdoWsh.vbs D:\Cmg2000\AdoWsh.vbs

32 RDS Script - WSH Set rs = CreateObject("ADODB.Recordset") ConnectionString = Provider=MS Remote; + _ Remote Server=http://ServerName; + _ Handler=MSDFMAP.Handler;+ _ Data Source=SasRemote Sql = Select PCTCPUTM from PDB.System rs.Open Sql, ConnectionString While Not rs.EOF Msg = Msg + CStr(rs.Fields(0).Value) + vbCrLf rs.MoveNext end MsgBox MsgD:\Cmg2000\RdsWsh.vbsD:\Cmg2000\RdsWsh.vbs

33 ADO Script – Client-Side Set rs = CreateObject("ADODB.Recordset") ConnectionString = "DSN=SasLocal Sql = Select PCTCPUTM from PDB.System rs.Open Sql, ConnectionString While Not rs.EOF Msg = Msg + rs.Fields(0).Value + vbCrLf rs.MoveNext end MsgBox Msg D:\Cmg2000\AdoClient.htmD:\Cmg2000\AdoClient.htm

34 ADO Script – Server-Side " + vbCrLf) While Not rs.EOF str = " " + CStr(rs.Fields(0).Value) + vbCrLf Response.Write(str) rs.MoveNext Wendhttp://.../AdoServer.asp %>

35 ADO Script Options Access TypeScript MethodAccess Method Local MachineWSH or Client-Side Any Client / ServerWSH or Client-Side RDS or OLE DB Intranet UNC Accessible Client-SideRDS or OLE DB InternetServer-SideAny

36 ActiveX Objects

37 COM subroutines Visible and not Microsoft and not ProgId (OWC.Spreadsheet) or ClassId 0002E C Create them Read/write properties Call methods Handle events


39 ActiveX – No Script D:\Cmg2000\NoScript.htm

40 ActiveX – Data Bound Set rs = CreateObject("ADODB.Recordset") Set cn = CreateObject("ADODB.Connection") cn.Open "Provider=sas.LocalProvider.1;Data Source=d:\PDB\ rs.Open System", cn,,, 512 'adCmdTableDirect set grid.DataSource = rs D:\Cmg2000\DataBound.htmD:\Cmg2000\DataBound.htm

41 Microsoft Office Web Components

42 Office Web Components Ship with Office 2000 c:\Program Files\MicrosoftOffice\Office\MsOwc.dll Spreadsheet clsid:0002E C ProgId = OWC.Spreadsheet Chart clsid:0002E C ProgId = OWC.Chart Pivot Table - OWC.PivotTable DSC - OWC.DataSourceControl

43 OWC Spreadsheet Resembles Excel spreadsheet Visible or not Contains one or more Worksheets Worksheets contain cells spreadsheet.worksheet.Cell(row,col) Single Worksheet then spreadsheet.Cell(row,col)

44 OWC Spreadsheet Range Identifies a rectangular group of cells Used by methods that operate on groups of cells set Range = spreadsheet.Columns(x) object.Range(TopLeft : BottomRight)

45 OWC Spreadsheet API ss.ActiveSheet.UsedRange.Clear ss.ViewableRange = ss.ActiveSheet.UsedRange.Address ExcelStyleCellReference = ss.Columns(Columns).Address Set c = ss.Constants Constants available at run-time

46 OWC Spreadsheet Formatting ss.TitleBar.Caption = string" ss.Columns.ColumnWidth = 100 ss.Rows(x).Font.Bold = True range.NumberFormat = "hh:mm ss.Columns(x).Hidden = True ss.DisplayRowHeaders = False ss.ScreenUpdating = False

47 Populate Spreadsheet from RecordSet Row = 1 While Not rs.EOF Col = 1 While Col <= rs.Fields.Count ss.ActiveSheet.Cells(Row, Col).Value = rs.Fields(Col - 1).Value Col = Col + 1 Wend Row = Row + 1 rs.MoveNext Wend

48 Populate Faster Set field = rs.Fields Set cell = ss.ActiveSheet.Cells Row = 1 While Not rs.EOF Col = 1 While Col <= rs.Fields.Count cell(Row, Col).Value = field(Col - 1).Name Col = Col + 1 Wend Row = Row + 1 rs.MoveNext Wend

49 OWC Chart General purpose charting functions 45 chart types ChartSpace - one or more charts Careful with terminology Series – points to be plotted as a group Value axis is vertical (y) Category axis is horizontal (x)

50 Chart Types Column Bar Line Pie Scatter Bubble Area Doughnut Radar Stock Polar Clustered Stacked Stacked100 Markers Smooth Exploded Filled HLC OHLC Combo

51 OWC Chart API Set cs.DataSource = ss.Object Chart data will come from spreadsheet Set chart = cs.Charts.Add() Add a chart to the chart space cs.Clear Clear all charts in the chart space Set c = cs.Constants Constants available at run-time

52 OWC Chart - Formatting chart.Type = c.chChartTypeLine Basic chart type – 46 varieties chart.HasLegend = True Chart will have legend chart.HasTitle = True Chart will have title chart.Title.Caption = C1 Take title from cell C1 in spreadsheet

53 OWC Chart - SetData Method used to identify series 1) Dimension or attribute of chart 2) Data source 3) Data Reference chart.SetData c.chDimSeriesNames, 0, A2 Variable name that will appear in legend chart.SetData c.chDimValues, 0, C2:C4 Cells containing value (y) axis data points chart.SetData c.chDimCategories, 0, B2:B4 Cells with category (x) axis data points

54 OWC Chart Series

55 ABC 1ProcessStarTimePctCpuTm 2InetInfo01:0030 3InetInfo02:0020 4InetInfo03:0025

56 Chart from Spreadsheet set cs.DataSource = ss.Object Set chart = cs.Charts.Add() Set c = cs.Constants chart.Type = c. chChartTypeColumnClustered chart.HasLegend = True chart.SetData c.chDimSeriesNames, 0, A2 chart.SetData c.chDimValues, 0, C2:C4 chart.SetData c.chDimCategories, 0, B2:B4"

57 References Programming Microsoft Office 2000 Web Components By Dave Stearns Microsoft Press

58 References SAS ODBC Users Guide and Programmers Reference, SAS Institute Microsoft Developer Network Library (MSDN) Microsoft TechNet newsgroups Public.Data.ADO.RDS Public.Office.Developer.Web.Components

59 SasToOwc.htm – Sample App D:\Cmg2000\SasToOwc.htm

60 Issues Much of this is Windows-only technolgy Un-terminated character strings when accessing SAS ODBC data sources through RDS

61 Summary

Download ppt "Publishing Your PDB Under Windows Jim Quigley conEdison."

Similar presentations

Ads by Google