Top Banner
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
60

Publishing Your PDB Under Windows Jim Quigley conEdison.

Mar 26, 2015

Download

Documents

Amber Ray
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

Introduction

Tutorial

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

Local machineLegacy client/server Intranet/Internet

Page 3: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

Agenda

ScriptingData Access Methods Overview Configuration Issues Sample Scripts

ActiveX Controls Overview Sample Scripts Office Web Components

Page 6: Publishing Your PDB Under Windows Jim Quigley conEdison.

Scripting

Page 7: Publishing Your PDB Under Windows Jim Quigley conEdison.

Scripting

Script is the glue

Vbscript and Jscript

Legacy WindowsWSH – Windows Scripting Host

BrowserClient-side and Server-side

Page 8: Publishing Your PDB Under Windows Jim Quigley conEdison.

Scripting

SAS

SQLServer

AccessWindow

BrowserMDAC

Script

ACTIVEX

Page 9: Publishing Your PDB Under Windows Jim Quigley conEdison.

MDAC

Microsoft Data Access Components

Page 10: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

MDAC

Non-SQL DB

SQL-aware Database

ODBC

OLE DB

ADO

Application

MS ODBCProvider

Page 12: Publishing Your PDB Under Windows Jim Quigley conEdison.

ODBC

Circa 1990

Ubiquitous drivers

Not an Object-Oriented API

Relational bias

Page 13: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

ADO

(currently) Highest level interface

Simplified object structure

Relies on OLE DB

Page 15: Publishing Your PDB Under Windows Jim Quigley conEdison.

RDS

Makes ADO data sources accessible across a network

HTTP, HTTPS, or DCOM

Uses Microsoft Internet Information Server as conduit

Page 16: Publishing Your PDB Under Windows Jim Quigley conEdison.

RDS

IIS

OLE DB Provider

ODBC Driver

Database

Application

ADO

RequestingProcess

HTTP

ServingProcess

Page 17: Publishing Your PDB Under Windows Jim Quigley conEdison.

MDAC Configuration Issues

Page 18: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

SAS TCP Port

Page 20: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

MSDFMAP.ini

RDS Security

C:\WinNT\System\MSDFMAP.ini

Create token to identify local data source for remote access

Determine permitted access

Page 22: Publishing Your PDB Under Windows Jim Quigley conEdison.

MSDFMAP.ini

Page 23: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

MDAC Interfaces

Page 26: Publishing Your PDB Under Windows Jim Quigley conEdison.

ADO Objects

Connection RecordSet

Fields

Command

ParametersErrors

Properties

Page 27: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

Warning

Code to Follow

Page 30: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

ActiveX Objects

Page 36: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

ActiveX – No Script

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

D:\Cmg2000\NoScript.htm

Page 39: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

Microsoft Office Web Components

Page 41: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

Chart Types

ColumnBar Line Pie Scatter Bubble Area Doughnut RadarStockPolar

ClusteredStacked Stacked100MarkersSmooth ExplodedFilledHLC OHLCCombo

Page 50: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

OWC Chart Series

0

5

10

15

20

25

30

1:00 2:00 3:00

InetInfo

Page 54: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

References

Programming Microsoft Office 2000 Web Components

By Dave Stearns

Microsoft Press

Page 57: Publishing Your PDB Under Windows Jim Quigley conEdison.

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: Publishing Your PDB Under Windows Jim Quigley conEdison.

SasToOwc.htm – Sample App

D:\Cmg2000\SasToOwc.htm

Page 59: Publishing Your PDB Under Windows Jim Quigley conEdison.

Issues

Much of this is Windows-only technolgy

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

Page 60: Publishing Your PDB Under Windows Jim Quigley conEdison.

Summary