openedge dataservers how to connect to oracle and sql server tips and techniques
DESCRIPTION
OpenEdge DataServers How to Connect to Oracle and SQL Server Tips and Techniques. Simon Epps. Solutions Engineer, Progress OpenEdge. Agenda Slide. Introduction Today’s Best Practices Tomorrow’s Best Practices Summary Questions and Answers. DataServer Technology Introduction. -. -. -. - PowerPoint PPT PresentationTRANSCRIPT
© 2007 Progress Software Corporation1
OpenEdge DataServers
How to Connect to Oracle and SQL Server Tips and Techniques
Simon EppsSolutions Engineer, Progress OpenEdge
© 2007 Progress Software Corporation3
Agenda Slide
Introduction Today’s Best Practices Tomorrow’s Best Practices Summary Questions and Answers
© 2007 Progress Software Corporation4
OpenEdge Client
DataServer
Schema Holder
DataServer Technology Introduction
Respond to Business Drivers• Integration & Corporate Standards
Progress ABL functionality and behavior against non-OpenEdge databases• OLTP processing• Native RDBMS connectivity and functionality• Unix and Windows Clients (GUI, CHUI, UBroker)
---
---
Oracle
SQL Server
OpenEdge
Database
---
---
© 2007 Progress Software Corporation5
DataServer Components
OpenEdge ClientOpenEdge
Database
OpenEdge
Database
A world without the DataServer Technology ABL
© 2007 Progress Software Corporation6
DataServer Components
OpenEdge Client
DataServer
OpenEdge
Database
OpenEdge
Database
Oracle
SQL Server
Oracle
SQL Server
The DataServer technology
Embedded in to the OpenEdge Client• GUI• CHUI• Unified Brokers
ABL
SQL
© 2007 Progress Software Corporation7
DataServer Components
OpenEdge Client
DataServer
OpenEdge
Database
OpenEdge
Database
INT CHAR
1 Joe
2 Alsop
Oracle
SQL Server
Oracle
SQL Server
INT VARCHAR
3 Bill
4 Ellison
Schema Holder
Meta data mapping between OpenEdge and SQL
No application data is stored
ABL
SQL
--
--
VARCHARINT
--
--
CHARINT
© 2007 Progress Software Corporation8
Adopting the OpenEdge DataServer
Not all DBMS’s are created equal• Performance• Scalability• Simulation of ABL features not always possible
– No SHARE-LOCK– No WORD INDEXING
• Simulation of ABL features not easy with SQL– FIND FIRST takes multiple SQL calls
Must set goals and expectations early with frequent validation checks
WARNING - Expectations must be set correctly
© 2007 Progress Software Corporation9
Terminology & Technology Sync-up
OpenEdge Client
DataServer
OpenEdge
Database
OpenEdge
Database
INT CHAR
1 Joe
2 Alsop
Oracle
SQL Server
Oracle
SQL Server
INT VARCHAR
3 Bill
4 Ellison
SQL
--
--
VARCHARINT
--
--
CHARINT
DataServer Broker
SQL
--
--
FOR EACH Customer: DISPLAY name.END.
ABL
ODBC OCI
© 2007 Progress Software Corporation10
DataServer Technology SQL Versus Progress ABL
Same Functionality Same Performance Same Ease of Use
DECLARE @STARTDATE DATETIME
DECLARE @CustName CHAR, @CustCredit INT
DECLARE @C1 INT
SELECT @STARTDATE = GETDATE()
DECLARE C1 CURSOR FOR SELECT creditlimit FROM customer
OPEN C1
FETCH NEXT FROM C1
WHILE (@@fetch_status <> -1)
BEGIN
BEGIN TRAN
UPDATE customer
SET CreditLimit = 44333
WHERE CURRENT OF C1
IF @@ERROR <> 0
ROLLBACK TRAN
ELSE
COMMIT TRAN
FETCH NEXT FROM C1
END
CLOSE C1
DEALLOCATE C1
SELECT DATEDIFF(MS, @STARTDATE, GETDATE()) as ETIME
GO
Transact SQLProgress ABL
DEF VAR tstart AS INT NO-UNDO.
DEF VAR MyRandom AS INT NO-UNDO.
MyRandom = RANDOM(10,2000).
tstart = ETIME.
FOR EACH customer EXCLUSIVE-LOCK:
creditlimit = MyRandom.
END.
DISPLAY ETIME - tstart.
© 2007 Progress Software Corporation11
Today’s Best Practices
1) Use the OpenEdge RDBMS where possible
2) Make it FunctionNot all ABL functionality can be emulated via SQL• Source scanning utility, Profiler, Data Width utility
3) Make it Perform (Optional)SQL emulation of ABL can be complex and costly• Use Results Set friendly ABL commands
– Progress ABL row set orientated– SQL results set orientated
• Leverage RDBMS Stored Procedures– Data Access & – Business logic
© 2007 Progress Software Corporation12
Tomorrow’s Best Practices
1) Use the OpenEdge RDBMS where possible
2) Make it FunctionNot all ABL functionality can be emulated via SQL• Source scanning utility, Profiler, Data Width utility
3) Make it Perform (Optional)SQL emulation of ABL can be complex and costly• Use Results Set friendly ABL commands
– Progress ABL row set orientated– SQL results set orientated
• Leverage RDBMS Stored Procedures– Data Access & – Business logic Better ABL integration
Make it easier to stay within the Progress
ABL
© 2007 Progress Software Corporation13
Best PracticesWhy focus on RDBMS Stored Procedures?
Benefits• Offload work from client to RDBMS
• General RDBMS Best Practices
• Akin to OpenEdge Application Server
Considerations• Integrating returned Data
• SQL knowledge needed
• Source code can become RDBMS dependant
© 2007 Progress Software Corporation14
Tomorrow’s Best Practices (today)
Data Access Layer – Black Box Data:• Keep Business Logic in the ABL
• Use Stored Procedures for Data access
Users Users
Presentation Layer/s
Business Servicing Layers
Data Access Layers
Managed Data Stores
Managed Data Stores
Unmanaged Data Stores
Unmanaged Data Stores
Enterprise Services
Enterprise Services
Integration Layer/s
Leverage the OpenEdge Reference Architecture
ABL Business Logic
ProDataSet
Oracle
SQL Server
OpenEdge
Database
© 2007 Progress Software Corporation15
RDBMS Stored ProceduresCurrent techniques
DataServerDataServer
ABL
SQL EXEC
STORED
PROCEDURE
“SELECT * FROM Customer”
CLIENT RDBMS OUTPUT FORMAT
SELECT * FROM
Customer
© 2007 Progress Software Corporation16
RDBMS Stored ProceduresCurrent techniques
DataServer
PROC-TEXT-BUFFER
DataServer
4GL
SQL EXEC
STORED
PROCEDURE
“SELECT * FROM Customer”
FOR EACH PROC-TEXT-BUFFER:
DISPLAY PROC-TEXT-BUFFER.
“A & A Athletic & Rec 1990 ...”
“A & J Sports Inc 1231 …”
“A A Collegiate Pennant Co 1303 ...”
CLIENT RDBMS OUTPUT FORMAT
SELECT * FROM
Customer
© 2007 Progress Software Corporation17
RDBMS Stored ProceduresCurrent techniques
PROC-TEXT-BUFFER
PROC-TEXT-BUFFER
In/Out/Rtn PARAMS
ABL BUFFER
DataServer
ABL
SQL EXEC
STORED
PROCEDURE
USER DEFINED
STORED
PROCEDURE
RDBMS
BUFFER
CLIENT RDBMS OUTPUT FORMAT
Input/Output/Return PARAMETERS
© 2007 Progress Software Corporation18
PROC-TEXT-BUFFER
PROC-TEXT-BUFFER
In/Out/Rtn PARAMS
ABL BUFFER
DataServer
ABL
SQL EXEC
STORED
PROCEDURE
USER DEFINED
STORED
PROCEDURE
RDBMS
BUFFER
CLIENT RDBMS OUTPUT FORMAT
Input/Output/Return PARAMETERS
RDBMS Stored ProceduresCurrent techniques
PROC-TEXT-BUFFER
PROC-TEXT-BUFFER
In/Out/Rtn PARAMS
ABL BUFFER
DataServer
ABL
SQL EXEC
STORED
PROCEDURE
USER DEFINED
STORED
PROCEDURE
RDBMS
BUFFER
CLIENT RDBMS OUTPUT FORMATRDBMS
Level of Integration Work
MEDIUMMEDIUM
MEDIUM
LOW
LOW
HIGH
HIGH
HIGH
ABL
© 2007 Progress Software Corporation19
DEFINE VAR SP-Handle AS INT.
RUN STORED-PROC send-sql-statementSP-Handle = PROC-HANDLE
("select * from customer").
FOR EACH PROC-TEXT-BUFFER WHERE PROC-HANDLE = SP-Handle. DISPLAY PROC-TEXT-BUFFER.
END.
CLOSE STORED-PROC send-sql-statement WHERE PROC-HANDLE = SP-Handle.
RDBMS Stored Procedures Send-SQL & PROC-TEXT Buffer
SQL EXEC RDBMS Stored
Procedure
SQL Statement
ABL Buffer
SINGLE CHAR COLUMN
© 2007 Progress Software Corporation20
DEFINE VAR SP-Handle AS INT.
RUN STORED-PROC My-RDBMS-ProcedureSP-Handle = PROC-HANDLE.
FOR EACH PROC-TEXT-BUFFER WHERE PROC-HANDLE = SP-Handle. DISPLAY PROC-TEXT-BUFFER.
FOR EACH My-RDBMS-VIEW WHERE PROC-HANDLE = SP-Handle. DISPLAY My-RDBMS-VIEW.
END.
RDBMS Stored Procedures User Defined and BUFFERS
User Defined RDBMS Stored
Procedure
RDBMS BUFFER
&
4GL BUFFER
4GL Buffer
SINGLE CHAR COLUMN
© 2007 Progress Software Corporation21
RDBMS Stored ProceduresNew techniques
PROC-TEXT-BUFFER
ABL TEMPTABLE
PROC-TEXT-BUFFER
In/Out/Rtn PARAMS
DataServer
4GL
SQL EXEC
STORED
PROCEDURE
USER DEFINED
STORED
PROCEDURE
ABL BUFFER
RDBMS
BUFFER
CLIENT RDBMS OUTPUT FORMAT
ABL
SQL EXEC
STORED
PROCEDURE
RDBMS
Level of Integration Work
MEDIUMMEDIUM
MEDIUM
LOW
LOW
HIGH
HIGH
HIGH
ABL
LOW LOW
© 2007 Progress Software Corporation22
Tomorrow’s Best PracticesNew for OpenEdge 10.1A
Automatic ABL TempTable population via Stored Procedures
DEFINE VAR ttHandle AS HANDLE EXTENT 1.RUN STORED-PROC <RDBMS Stored Procedure>
load-result-into ttHandle.
Accepts Results set(s) from any Stored Procedure SQL and TempTable columns must match Available in V9.1E & R10.0B (Technical Preview)
© 2007 Progress Software Corporation23
Tomorrow’s Best PracticesStored Procedures & TempTables
DEFINE VAR ttHandle AS HANDLE EXTENT 1 NO-UNDO.DEFINE TEMP-TABLE ttCust LIKE Sports.Customer
FIELD tRecid AS INT FIELD tRECID_ident AS INT.
ttHandle[1] = TEMP-TABLE ttCust:HANDLE.
RUN STORED-PROC send-sql-statementload-result-into ttHandle
("select * from customer").
FOR EACH ttCust: DISPLAY name custnum address creditlimit.END.
© 2007 Progress Software Corporation24
Tomorrow’s Best PracticesTempTable integration
Dynamic TempTable support
DEFINE VARIABLE hBrowse AS HANDLE NO-UNDO.DEFINE VARIABLE ttHandle AS HANDLE NO-UNDO.CREATE TEMP-TABLE ttHandle. RUN STORED-PROC send-sql-statement
load-result-into ttHandle("select * from customer").
hBrowse = ttHandle:DEFAULT-BUFFER-HANDLE.CREATE QUERY q.q:SET-BUFFERS(hBrowse).q:QUERY-PREPARE("for each " + ttHandle:name).q:QUERY-OPEN.
© 2007 Progress Software Corporation25
Tomorrow’s Best PracticesTempTable integration
Multiple Result Sets SQL Server = Send-SQL-Statement STORED PROCEDURE Oracle = User Defined STORED PROCEDURE
CREATE TEMP-TABLE tt1.CREATE TEMP-TABLE tt2.
DEF VAR ttHandle AS HANDLE EXTENT 2.ttHandle[1] = tt1.ttHandle[2] = tt2. RUN STORED-PROC send-sql-statement load-result-into ttHandle ("select * from customer select * from order").
© 2007 Progress Software Corporation26
Tomorrow’s Best PracticesTempTable integration (1 of 2)
ProDataSet - BEFORE-FILL Method
DEFINE DATASET dsCustOrd FOR ttCust, ttOrder DATA-RELATION dsCustOrd FOR ttCust, ttOrder
RELATION-FIELDS(custnum, custnum).
DEFINE VAR phDataSet AS HANDLE NO-UNDO. phDataSet = DATASET dsCustOrd:HANDLE.
phDataSet:SET-CALLBACK-PROCEDURE ("BEFORE-FILL", "preDataSetFill", THIS-PROCEDURE).
(1)
(2)
© 2007 Progress Software Corporation27
Tomorrow’s Best PracticesTempTable integration (2 of 2)
PROCEDURE PreDataSetFill: DEF VAR ttHandle AS HANDLE EXTENT 2. ttHandle[1] = TEMP-TABLE ttCust:HANDLE. ttHandle[2] = TEMP-TABLE ttOrder:HANDLE.
IF DBTYPE(NUM-DBS) <> "PROGRESS" THEN DO: BUFFER ttCust:handle:FILL-MODE = "NO-FILL". RUN STORED-PROC send-sql-statement load-result-into ttHandle ("select * from customer select * from order"). END. ELSE DO: /* normal OpenEdge FILL procedure */ QUERY qCust:QUERY-PREPARE("for each customer"). END. END PROCEDURE. /* preDataSetFill */
(3)
(4)(5)
(6)
© 2007 Progress Software Corporation28
Tomorrow’s Best PracticesTempTable integration
DEFINE TEMP-TABLE ttCust LIKE Sports.CustomerFIELD tRecid AS INT
FIELD tRECID_ident AS INT.
RUN STORED-PROC send-sql-statement load-result-into ttHandle
("select * from customer").
FOR EACH ttCust: DISPLAY tRecid.END.
ROWID• Progress = 116 unique character value• Dependant on RECID & TableName
0x0039001600010000574845524520282850524f47524553535f5245434944203d2000000130004000400000000000000000000000129292000
1
2
3
4
5
6
….
© 2007 Progress Software Corporation29
Tomorrow’s Best PracticesTempTable integration
ROWID requires ProDataSet association
DEFINE TEMP-TABLE ttCust LIKE Sports.CustomerFIELD tRecid AS ROWID
FIELD tRECID_ident AS INT.
DEFINE VAR phDataSet AS HANDLE NO-UNDO.BUFFER ttCust:handle:ATTACH-DATA-SOURCE(DATA-SOURCE dsCust:HANDLE,?,?,?).
RUN STORED-PROC send-sql-statement load-result-into ttHandle
("select * from customer").FOR EACH ttCust: DISPLAY tRecid.END.
0x00390016000100923……
0x00390016000100923……
0x00390016000100923……
0x00390016000100923……
0x00390016000100923……
0x00390016000100923……
0x00390016000100923……
…
© 2007 Progress Software Corporation30
Oracle
SQL Server
ProDataSet Demonstration
Theory into Practice ….• Performance optimized at a Data Access• Single ‘view’ into multiple Data Sources
---
---
---
Methods:
Dataset:Before-fill
Buffer:Before-fill
Before-row-fill
Row-Add
Row-Delete
….
ProDataSet
ABL
Business
Logic
OpenEdge
Database
© 2007 Progress Software Corporation31
Agenda Slide
Introduction Today’s Best Practices Tomorrow’s Best Practices Summary Questions and Answers
© 2007 Progress Software Corporation32
In Summary
‘Out of Box’ functionality and performance may be all you need
Improved Progress ABL and RDBMS Stored Procedure integration
No longer a ‘check box’ technology. Develop, deploy and integrate with confidence
© 2007 Progress Software Corporation33
Questions?