introduction

60
Reset Member: Fo... Member System in Library d:\PDB\ Beginning Thursday, November 02, 2000 PCTRGQTA PCTDPCTM PCTINTTM PCTPRVTM PCTCPUTM PCTUSRTM ALIGFIXU CNTXTSWT 15.71 0.845 0.331 6.189 19.672 13.485 0. 391.76 15.71 0.389 0.169 3.656 11.709 8.053 0. 222.26 15.71 0.367 0.168 3.704 12.458 8.752 0. 248.41 15.71 0.273 0.127 2.637 8.585 5.947 0. 189.7 15.71 0.35 0.139 3.223 11.723 8.5 0. 215.09 15.71 0.395 0.146 3.423 10.739 7.315 0. 226.97 15.71 0.563 0.205 4.357 13.092 8.735 0. 267.9 15.71 0.929 0.311 6.579 19.929 13.352 0. 361.80 15.822 1.197 0.402 10.362 29.489 19.128 0. 459.92 16.38 1.419 0.482 28.815 53.956 25.141 0. 523.81 16.38 1.272 0.43 12.282 33.391 21.107 0. 484.00 16.38 1.303 0.452 12.243 34.578 22.335 0. 508.45 16.38 1.262 0.438 11.22 32.047 20.827 0. 492.23 I J K L M N O P 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0. 0.5 1. 1.5 Series

Upload: kylynn-chen

Post on 30-Dec-2015

30 views

Category:

Documents


0 download

DESCRIPTION

Introduction. Tutorial How to publish the contents of a database using features available in Microsoft Windows Local machine Legacy client/server Intranet/Internet. Introduction. “Might be a little bit heavy on the VB/ HTML side for old-time capacity planners...” Vic Soder, CMG ERB - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Introduction

Reset

Member: Folder:

Member System in Library d:\PDB\ Beginning Thursday, November 02, 2000

PCTRGQTA PCTDPCTM PCTINTTM PCTPRVTM PCTCPUTM PCTUSRTM ALIGFIXU CNTXTSWT15.71 0.845 0.331 6.189 19.672 13.485 0. 391.76115.71 0.389 0.169 3.656 11.709 8.053 0. 222.26815.71 0.367 0.168 3.704 12.458 8.752 0. 248.41715.71 0.273 0.127 2.637 8.585 5.947 0. 189.7215.71 0.35 0.139 3.223 11.723 8.5 0. 215.09315.71 0.395 0.146 3.423 10.739 7.315 0. 226.97215.71 0.563 0.205 4.357 13.092 8.735 0. 267.9615.71 0.929 0.311 6.579 19.929 13.352 0. 361.801

15.822 1.197 0.402 10.362 29.489 19.128 0. 459.92916.38 1.419 0.482 28.815 53.956 25.141 0. 523.81416.38 1.272 0.43 12.282 33.391 21.107 0. 484.00316.38 1.303 0.452 12.243 34.578 22.335 0. 508.45616.38 1.262 0.438 11.22 32.047 20.827 0. 492.237

I J K L M N O P123456789

1011121314

0.

0.5

1.

1.5

Series

Page 2: Introduction

Introduction

Tutorial

How to publish the contents of a database using features available in Microsoft Windows

Local machineLegacy client/server Intranet/Internet

Page 3: Introduction

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.

Page 4: Introduction

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

Page 5: Introduction

Agenda

ScriptingData Access Methods Overview Configuration Issues Sample Scripts

ActiveX Controls Overview Sample Scripts Office Web Components

Page 6: Introduction

Scripting

Page 7: Introduction

Scripting

Script is the glue

Vbscript and Jscript

Legacy WindowsWSH – Windows Scripting Host

BrowserClient-side and Server-side

Page 8: Introduction

Scripting

SAS

SQLServer

AccessWindow

BrowserMDAC

Script

ACTIVEX

Page 9: Introduction

MDAC

Microsoft Data Access Components

Page 10: Introduction

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 - ???

Page 11: Introduction

MDAC

Non-SQL DB

SQL-aware Database

ODBC

OLE DB

ADO

Application

MS ODBCProvider

Page 12: Introduction

ODBC

Circa 1990

Ubiquitous drivers

Not an Object-Oriented API

Relational bias

Page 13: Introduction

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

Page 14: Introduction

ADO

(currently) Highest level interface

Simplified object structure

Relies on OLE DB

Page 15: Introduction

RDS

Makes ADO data sources accessible across a network

HTTP, HTTPS, or DCOM

Uses Microsoft Internet Information Server as conduit

Page 16: Introduction

RDS

IIS

OLE DB Provider

ODBC Driver

Database

Application

ADO

RequestingProcess

HTTP

ServingProcess

Page 17: Introduction

MDAC Configuration Issues

Page 18: Introduction

ODBC Data Sources

Control PanelAdministrative Tools

Data Sources (ODBC)

SAS ODBC Drivers System Data Source TCP Port

c:\WINNT\system32\drivers\etc\services

Page 19: Introduction

SAS TCP Port

Page 20: Introduction

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

Page 21: Introduction

MSDFMAP.ini

RDS Security

C:\WinNT\System\MSDFMAP.ini

Create token to identify local data source for remote access

Determine permitted access

Page 22: Introduction

MSDFMAP.ini

Page 23: Introduction

MSDFMAP.ini

[connect default]Access=NoAccess[sql default];Sql=" “ ' <---comment this line out[connect PDB]Access=ReadOnlyConnect="Provider=sas.LocalProvider.1;

Data Source=d:\PDB\Detail\“[connect SasRemote]Access=ReadOnlyConnect="Data Source=SasLocal"

Page 24: Introduction

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

Page 25: Introduction

MDAC Interfaces

Page 26: Introduction

ADO Objects

Connection RecordSet

Fields

Command

ParametersErrors

Properties

Page 27: Introduction

RecordSet Object

Set rs = CreateObject(“ADODB.Recordset”)

Methods rs.Open, rs.Close rs.MoveFirst, Rs.MoveNext

Properties rs.BOF, rs.EOF rs.Connection

Page 28: Introduction

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

Page 29: Introduction

Warning

Code to Follow

Page 30: Introduction

ADO Script - WSH

Set rs = CreateObject(“ADODB.Recordset”)ConnectionString = “DSN=SasLocal”Sql = “Select PCTCPUTM from PDB.System”rs.Open Sql, ConnectionStringWhile Not rs.EOF

Msg = Msg + CStr(rs.Fields(0).Value) + vbCrLfrs.MoveNextend

MsgBox MsgD:\Cmg2000\AdoWsh.

vbs

Page 31: Introduction

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, ConnectionStringWhile Not rs.EOF

Msg = Msg + CStr(rs.Fields(0).Value) + vbCrLfrs.MoveNextend

MsgBox Msg D:\Cmg2000\RdsWsh.vbs

Page 32: Introduction

ADO Script – Client-Side

<HTML><SCRIPT LANGUAGE=vbscript>Set rs = CreateObject("ADODB.Recordset")ConnectionString = "DSN=SasLocal“Sql = “Select PCTCPUTM from PDB.System“rs.Open Sql, ConnectionStringWhile Not rs.EOF

Msg = Msg + rs.Fields(0).Value + vbCrLfrs.MoveNextend

MsgBox Msg</SCRIPT></HTML> D:\Cmg2000\AdoClient.htm

Page 33: Introduction

ADO Script – Server-Side

<HTML><%Set rs = CreateObject("ADODB.Recordset")ConnectionString = "Data Source=SasLocal“Sql = "Select PCTCPUTM from PDB.System“rs.Open Sql, ConnectionStringResponse.Write("<SELECT>" + vbCrLf)While Not rs.EOF str = "<OPTION>" + CStr(rs.Fields(0).Value) + vbCrLf Response.Write(str) rs.MoveNextWend http://.../AdoServer.asp%> </OPTION></SELECT> </HTML>

Page 34: Introduction

ADO Script Options

Access Type Script Method Access Method

Local Machine WSH orClient-Side

Any

Client / Server WSH orClient-Side

RDS orOLE DB

Intranet UNC Accessible

Client-Side RDS orOLE DB

Internet Server-Side Any

Page 35: Introduction

ActiveX Objects

Page 36: Introduction

ActiveX Objects

COM subroutinesVisible and notMicrosoft and notProgId (OWC.Spreadsheet) or ClassId“0002E510-0000-0000-C000-000000000046” Create them Read/write properties Call methods Handle events

Page 37: Introduction

Submit

Member: Folder:

Member System in Library d:\PDB\ Beginning Thursday, November 02, 2000

A B C D E F G H123456789

1011121314

Page 38: Introduction

ActiveX – No Script

<HTML><OBJECT HEIGHT=500 WIDTH=100%classid=clsid:C4D2D8E0-D1DD-11CE-940F-008029004347></OBJECT></HTML>

D:\Cmg2000\NoScript.htm

Page 39: Introduction

ActiveX – Data Bound

<HTML><OBJECT id=grid height=600 width=100%classid=clsid:0ECD9B64-23AA-11D0-B351-00A0C9055D8E></OBJECT><SCRIPT LANGUAGE=vbscript>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 'adCmdTableDirectset grid.DataSource = rs</SCRIPT></HTML> D:\Cmg2000\DataBound.htm

Page 40: Introduction

Microsoft Office Web Components

Page 41: Introduction

Office Web Components

Ship with Office 2000c:\Program Files\MicrosoftOffice\Office\MsOwc.dll

Spreadsheet clsid:0002E510-0000-0000-C000-000000000046 ProgId = OWC.Spreadsheet

Chart clsid:0002E500-0000-0000-C000-000000000046 ProgId = OWC.Chart

Pivot Table - OWC.PivotTableDSC - OWC.DataSourceControl

Page 42: Introduction

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)

Page 43: Introduction

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)

Page 44: Introduction

OWC Spreadsheet API

ss.ActiveSheet.UsedRange.Clear

ss.ViewableRange = ss.ActiveSheet.UsedRange.Address

ExcelStyleCellReference = ss.Columns(Columns).Address

Set c = ss.ConstantsConstants available at run-time

Page 45: Introduction

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

Page 46: Introduction

Populate Spreadsheetfrom RecordSet

Row = 1While 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.MoveNextWend

Page 47: Introduction

Populate Faster

Set field = rs.FieldsSet cell = ss.ActiveSheet.CellsRow = 1While 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.MoveNextWend

Page 48: Introduction

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)

Page 49: Introduction

Chart Types

ColumnBar Line Pie Scatter Bubble Area Doughnut RadarStockPolar

ClusteredStacked Stacked100MarkersSmooth ExplodedFilledHLC OHLCCombo

Page 50: Introduction

OWC Chart API

Set cs.DataSource = ss.ObjectChart data will come from spreadsheet

Set chart = cs.Charts.Add()Add a chart to the chart space

cs.ClearClear all charts in the chart space

Set c = cs.ConstantsConstants available at run-time

Page 51: Introduction

OWC Chart - Formatting

chart.Type = c.chChartTypeLine Basic chart type – 46 varieties

chart.HasLegend = TrueChart will have legend

chart.HasTitle = TrueChart will have title

chart.Title.Caption = “C1”Take title from cell C1 in spreadsheet

Page 52: Introduction

OWC Chart - SetData

Method used to identify series1) Dimension or attribute of chart2) Data source3) 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

pointschart.SetData c.chDimCategories, 0, “B2:B4”

Cells with category (x) axis data points

Page 53: Introduction

OWC Chart Series

0

5

10

15

20

25

30

1:00 2:00 3:00

InetInfo

Page 54: Introduction

OWC Chart Series

A B C

1 Process StarTime PctCpuTm

2 InetInfo 01:00 30

3 InetInfo 02:00 20

4 InetInfo 03:00 25

Page 55: Introduction

Chart from Spreadsheet

set cs.DataSource = ss.ObjectSet chart = cs.Charts.Add()Set c = cs.Constantschart.Type = c. chChartTypeColumnClusteredchart.HasLegend = Truechart.SetData c.chDimSeriesNames, 0, “A2“chart.SetData c.chDimValues, 0, “C2:C4“chart.SetData c.chDimCategories, 0, “B2:B4"

Page 56: Introduction

References

Programming Microsoft Office 2000 Web Components

By Dave Stearns

Microsoft Press

Page 57: Introduction

References

SAS ODBC User’s Guide and Programmer’s Reference, SAS InstituteMicrosoft Developer Network Library (MSDN) Microsoft TechNetMSNews.Microsoft.com newsgroups

Public.Data.ADO.RDS Public.Office.Developer.Web.Components

http://www.Able-Consulting.com/

Page 58: Introduction

SasToOwc.htm – Sample App

D:\Cmg2000\SasToOwc.htm

Page 59: Introduction

Issues

Much of this is Windows-only technolgy

Un-terminated character strings when accessing SAS ODBC data sources through RDS

Page 60: Introduction

Summary