tibco adapter example

Upload: ajit250511

Post on 10-Feb-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/22/2019 TIBCO adapter example

    1/90

    TIBCO ActiveMatrixAdapter

    for Database

    Configuration and DeploymentSoftware Release 6.0

    April 2009

  • 7/22/2019 TIBCO adapter example

    2/90

    Important Information

    SOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDEDOR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE THE FUNCTIONALITY (OR PROVIDE LIMITEDADD-ON FUNCTIONALITY) OF THE LICENSED TIBCO SOFTWARE. THE EMBEDDED OR BUNDLEDSOFTWARE IS NOT LICENSED TO BE USED OR ACCESSED BY ANY OTHER TIBCO SOFTWARE OR FORANY OTHER PURPOSE.

    USE OF TIBCO SOFTWARE AND THIS DOCUMENT IS SUBJECT TO THE TERMS AND CONDITIONS OF ALICENSE AGREEMENT FOUND IN EITHER A SEPARATELY EXECUTED SOFTWARE LICENSEAGREEMENT, OR, IF THERE IS NO SUCH SEPARATE AGREEMENT, THE CLICKWRAP END USERLICENSE AGREEMENT WHICH IS DISPLAYED DURING DOWNLOAD OR INSTALLATION OF THESOFTWARE (AND WHICH IS DUPLICATED IN LICENSE.PDF) OR IF THERE IS NO SUCH SOFTWARELICENSE AGREEMENT OR CLICKWRAP END USER LICENSE AGREEMENT, THE LICENSE(S) LOCATEDIN THE LICENSE FILE(S) OF THE SOFTWARE. USE OF THIS DOCUMENT IS SUBJECT TO THOSE TERMSAND CONDITIONS, AND YOUR USE HEREOF SHALL CONSTITUTE ACCEPTANCE OF AND ANAGREEMENT TO BE BOUND BY THE SAME.

    This document contains confidential information that is subject to U.S. and international copyright laws andtreaties. No part of this document may be reproduced in any form without the written authorization of TIBCOSoftware Inc.

    TIB, TIBCO, TIBCO Adapter, Predictive Business, Information Bus, The Power of Now, TIBCO ActiveMatrixBusinessWorks, TIBCO Rendezvous, TIBCO Administrator, TIBCO Designer, TIBCO Runtime Agent, TIBCOHawk, TIBCO Enterprise Message Service, TIBCO Designer Add-in for TIBCO Business Studio, TIBCO

    ActiveMatrix Service Grid, TIBCO ActiveMatrix Service Bus, TIBCO ActiveMatrix BusinessWorks ServiceEngine, and TIBCO Business Studio are either registered trademarks or trademarks of TIBCO Software Inc. inthe United States and/or other countries.

    EJB, Java EE, J2EE, and all Java-based trademarks and logos are trademarks or registered trademarks of SunMicrosystems, Inc. in the U.S. and other countries.

    All other product and company names and marks mentioned in this document are the property of theirrespective owners and are mentioned for identification purposes only.

    THIS SOFTWARE MAY BE AVAILABLE ON MULTIPLE OPERATING SYSTEMS. HOWEVER, NOT ALLOPERATING SYSTEM PLATFORMS FOR A SPECIFIC SOFTWARE VERSION ARE RELEASED AT THE SAMETIME. SEE THE README.TXT FILE FOR THE AVAILABILITY OF THIS SOFTWARE VERSION ON A

    SPECIFIC OPERATING SYSTEM PLATFORM.THIS DOCUMENT IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS ORIMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.

    THIS DOCUMENT COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS.CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BEINCORPORATED IN NEW EDITIONS OF THIS DOCUMENT. TIBCO SOFTWARE INC. MAY MAKEIMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED INTHIS DOCUMENT AT ANY TIME.

    THE CONTENTS OF THIS DOCUMENT MAY BE MODIFIED AND/OR QUALIFIED, DIRECTLY ORINDIRECTLY, BY OTHER DOCUMENTATION WHICH ACCOMPANIES THIS SOFTWARE, INCLUDINGBUT NOT LIMITED TO ANY RELEASE NOTES AND "READ ME" FILES.

    Copyright 1999-2009 TIBCO Software Inc. ALL RIGHTS RESERVED.

    TIBCO Software Inc. Confidential Information

  • 7/22/2019 TIBCO adapter example

    3/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    | iii

    Contents

    Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v

    Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

    Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii

    TIBCO ActiveMatrix Adapter for Database Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viiiOther TIBCO Product Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii

    Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

    How to Contact TIBCO Customer Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

    Chapter 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    Before Starting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    Examples Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Using TIBCO ActiveMatrix BusinessWorks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    Using TIBCO IntegrationManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    Working with dat files in TIBCO Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    Chapter 2 Parent/Child Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    Create the Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    Configure the Properties Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    Create a Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    Create an Adapter Instance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    Add the Publication Service. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    Add a Table and a Child Table to the Publication Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    Add Two Child Tables to the ORDER_DETAILS Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    Create an Adapter Instance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    Add the Subscription Service. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    Add a Table and a Child Table to the Subscription Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    Add Two Child Tables to the SUB_ORDER_DETAILS Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

    Add Child Table Mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

    Change the Subject Name. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/
  • 7/22/2019 TIBCO adapter example

    4/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    iv | Contents

    Export the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

    Start the Adapters and Insert Data into the Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

    Stop the Adapters and Clean Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

    Chapter 3 Request-Response Service Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    Request-Response Exercise. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    Required Platforms and Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    RPC Standard Operation Support Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    Required Platforms and Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

    RPC Custom Operation Support Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

    Required Platforms and Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

    Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

    Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

    Chapter 4 TIBCO ActiveMatrix BusinessWorks: Processing a Sales Order. . . . . . . . . . . . . . . 71

    Example Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

    Setup the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

    Test the Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75Expected Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

    Run the Database Clean up Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/
  • 7/22/2019 TIBCO adapter example

    5/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    |v

    Figures

    Figure 1 Parent/Child Exercise, Publisher Side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    Figure 2 Parent/Child Exercise, Subscriber Side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/http://tib_adadb_examples.pdf/
  • 7/22/2019 TIBCO adapter example

    6/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    vi | Figures

  • 7/22/2019 TIBCO adapter example

    7/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    |vii

    Preface

    TIBCO ActiveMatrix Adapter for Database software is a bidirectional gatewaybetween databases and applications configured for the TIBCO environment. Thesoftware supports both publish-subscribe and request-response interactions. Thismanual provides a a hands-on introduction to the software.

    Topics

    Related Documentation, page viii

    How to Contact TIBCO Customer Support, page xi

  • 7/22/2019 TIBCO adapter example

    8/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    viii | Related Documentation

    Related Documentation

    This section lists documentation resources you may find useful.

    TIBCO ActiveMatrix Adapter for Database Documentation

    The following documents form the TIBCO ActiveMatrix Adapter for Databasedocumentation set:

    TIBCO ActiveMatrix Adapter for Database Concepts Read this manual to gain

    an understanding of adapters in general that you can apply to the varioustasks you may undertake.

    TIBCO ActiveMatrix Adapter for Database Installation Read this manual tolearn how to install TIBCO ActiveMatrix Adapter for Database.

    TIBCO ActiveMatrix Adapter for Database Configuration and Deployment Thismanual explains how to create and configure adapter projects. Information ondeploying adapter projects is also included.

    TIBCO ActiveMatrix Adapter for Database Examples Read this manual foradditional information about new features, closed and open issues.

    TIBCO ActiveMatrix Adapter for Database Release Notes Read this manual foradditional information about new features, closed and open issues.

    Other TIBCO Product Documentation

    You may find it useful to read the documentation for the following TIBCOproducts.

    TIBCO Designer

    TIBCO Administrator

    TIBCO ActiveMatrix BusinessWorks

    TIBCO Rendezvous

    TIBCO Enterprise Message Service

    TIBCO Hawk

    TIBCO Adapter SDK

    TIBCO Runtime Agent

  • 7/22/2019 TIBCO adapter example

    9/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    Preface | ix

    Typographical Conventions

    The following typographical conventions are used in this manual

    Table 1 General Typographical Conventions

    Convention Use

    TIBCO_HOME

    ENV_HOME

    Many TIBCO products must be installed within the same home directory. Thisdirectory is referenced in documentation as TIBCO_HOME. The value ofTIBCO_HOMEdepends on the operating system. For example, on Windows

    systems, the default value is C:\tibco.

    Other TIBCO products are installed into an installation environment.Incompatible products and multiple instances of the same product are installedinto different installation environments. The directory into which such productsare installed is referenced in documentation as ENV_HOME. The value ofENV_HOMEdepends on the operating system. For example, on Windowssystems the default value is C:\tibco.

    code font Code font identifies commands, code examples, filenames, pathnames, andoutput displayed in a command window. For example:

    Use MyCommandto start the foo process.

    bold code

    fontBold code font is used in the following ways:

    In procedures, to indicate what a user types. For example: Type admin.

    In large code samples, to indicate the parts of the sample that are ofparticular interest.

    In command syntax, to indicate the default parameter for a command. Forexample, if no parameter is specified, MyCommandis enabled:MyCommand [enable| disable]

    italic font Italic font is used in the following ways:

    To indicate a document title. For example: See TIBCO BusinessWorks Concepts. To introduce new terms For example: A portal page may contain several

    portlets. Portletsare mini-applications that run in a portal.

    To indicate a variable in a command or code syntax that you must replace.For example: MyCommandpathname

  • 7/22/2019 TIBCO adapter example

    10/90

  • 7/22/2019 TIBCO adapter example

    11/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    Preface |xi

    How to Contact TIBCO Customer Support

    For comments or problems with this manual or the software it addresses, pleasecontact TIBCO Support as follows.

    For an overview of TIBCO Support, and information about getting startedwith TIBCO Support, visit this site:

    http://www.tibco.com/services/support

    If you already have a valid maintenance or support contract, visit this site:

    https://support.tibco.com

    Entry to this site requires a user name and password. If you do not have a username, you can request one.

    http://www.tibco.com/services/supporthttps://support.tibco.com/https://support.tibco.com/http://www.tibco.com/services/support
  • 7/22/2019 TIBCO adapter example

    12/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    xii | How to Contact TIBCO Customer Support

  • 7/22/2019 TIBCO adapter example

    13/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    |1

    Chapter 1 Introduction

    This chapter lists the prerequisite steps to complete before starting the adapterexamples.

    Topics

    Before Starting, page 2

    Working with dat files in TIBCO Designer, page 4

  • 7/22/2019 TIBCO adapter example

    14/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    2 | Chapter 1 Introduction

    Before Starting

    Before performing any of these exercises, make sure that TIBCO ActiveMatrixAdapter for Database is installed according to the procedures in the TIBCO

    ActiveMatrix Adapter for Database Installation Guide. These procedures includecreating a database account for the adapter and setting the ODBC data source,among other things.

    You should be familiar with using TIBCO Designer to open and close projects anddrag and drop resources; see the TIBCO Designer Users Guidefor moreinformation. That document also describes the multiple file format used byTIBCO Designer, and converting to and from the .datfile format used by therun-time adapter. The TIBCO Designer Users Guideis available from TIBCODesigner by clicking the Help>Designer Helpmenu choice.

    Examples Location

    The examples are in the following location:

    \tibco\adapter\adadb\\demo

    Using TIBCO ActiveMatrix BusinessWorks

    If you are using the adapter with TIBCO ActiveMatrix BusinessWorks, thefollowing software must be installed to run the examples. Refer to the readme.txtfor the supported versions of the following software.

    TIBCO Runtime Agent

    TIBCO ActiveMatrix BusinessWorks

    TIBCO ActiveMatrix Adapter for Database

    Supported database. (See the TIBCO ActiveMatrix Adapter for DatabaseInstallationguide.)

    TIBCO Enterprise Message Service 4.x (if you are using the JMS transport)

    The TIBCO Enterprise Message Service server must be running and accessibleto the machine on which the adapter is installed.

  • 7/22/2019 TIBCO adapter example

    15/90

    4 | Chapter 1 Introduction

  • 7/22/2019 TIBCO adapter example

    16/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    4 | Chapter 1 Introduction

    Working with dat files in TIBCO Designer

    You cannot directly open a dat file in TIBCO Designer and make modifications tothe configurations. To be able to do this, you need to carry out the following steps:

    1. Convert the dat file to a multi-file project.

    a. Open Designer. In the first screen that is displayed, click Administration.

    b. Click the Convert DAT to Filesicon. In the window that is displayed,browse and select the dat file you wish to convert to a multi-file project.

    Click OK.

    2. Click the Open existing project icon from the first TIBCO Designer screen.Browse to the directory where the converted multi-file project is saved andselect it.

    3. Make configuration changes as per your requirements.

    4. Export the multi-file project to a dat by selecting Project>Export Full Project.

    Browse and select the location of the directory you wish to save the dat file to.Ensure that the directory is different from the multi-file project. Enter thename of the project and click OK.

    |5

  • 7/22/2019 TIBCO adapter example

    17/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    |5

    Chapter 2 Parent/Child Exercise

    This chapter explains how to configure an adapter instance to publish andsubscribe to data that is stored in related child tables.

    Topics

    Overview, page 6

    Create the Tables, page 10

    Configure the Properties Files, page 11

    Create a Project, page 13 Create an Adapter Instance, page 14

    Add the Publication Service, page 18

    Add a Table and a Child Table to the Publication Service, page 20

    Add Two Child Tables to the ORDER_DETAILS Table, page 23

    Create an Adapter Instance, page 27

    Add a Table and a Child Table to the Subscription Service, page 30

    Add Two Child Tables to the SUB_ORDER_DETAILS Table, page 32

    Add Child Table Mappings, page 34

    Change the Subject Name, page 35

    Start the Adapters and Insert Data into the Database, page 37

    Stop the Adapters and Clean Up, page 39

  • 7/22/2019 TIBCO adapter example

    18/90

    Overview |7

  • 7/22/2019 TIBCO adapter example

    19/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    |

    Figure 1 Parent/Child Exercise, Publisher Side

    Adapter Role

    After the CUSTOMER table is updated, the new data is copied to theP_CUSTOMER table, which is monitored by the publisher adapter. The publisher

    sends the updated information in a message.The subscriber adapter receives the same message and writes it to its destinationtables. These tables are shown in the following diagram.

    The subscription child table names are different from the publication child tablenames and must be mapped. The destination table has a top level relationshipdefined with the SUB_ORDER_DETAILS table, which has a secondary levelrelationship defined with the two child tables.

    TIBCO Messaging

    Publishing Table

    CUSTOMER

    CUSTIDNAME

    ADDRESS

    PHONE_NO

    P_CUSTOMER

    CUSTIDNAME

    ADDRESS

    PHONE_NO

    ADB_SUBJECT

    ADB_SEQUENCE

    ADB_SET_SEQUENCE

    ADB_TIMESTAMP

    ADB_OPCODE

    ADB_UPDATE_ALL

    ADB_L_DELIVERY_STATUS

    ADB_L_CMSEQUENCE

    EXTERNAL_ORDER_ITEMS

    ORDERID

    ITEMID

    QTY_ORDERED

    VENDORID

    INTERNAL_ORDER_ITEMS

    ORDERID

    ITEMID

    QTY_ORDERED

    ORDER_DETAILS

    ORDERID

    CUSTID

    SHIP_DATE

    ORDER_DATE

    TOTAL_COST

    top relationship

    secondaryrelationships

    Source Tables

    Publishing

    Table

    demo2pub

    (Publisher Adapter)

    8 | Chapter 2 Parent/Child Exercise

  • 7/22/2019 TIBCO adapter example

    20/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    |

    Figure 2 Parent/Child Exercise, Subscriber Side

    Tasks

    This exercise consists of the following tasks:

    Create the Tables

    Configure the Properties Files

    Create a Project

    Create an Adapter Instance

    Add a Table and a Child Table to the Publication Service

    Add Two Child Tables to the ORDER_DETAILS Table

    Create an Adapter Instance

    Add a Table and a Child Table to the Subscription Service

    Add Two Child Tables to the SUB_ORDER_DETAILS Table

    Add Child Table Mappings

    Change the Subject Name

    Destination Tables

    Exception

    Table

    EXCP_CUSTOMER

    CUSTID

    NAME

    ADDRESS

    PHONE_NO

    ADB_OPCODE

    ADB_UPDATE_ALL

    SUB_CUSTOMER

    CUSTIDNAME

    ADDRESS

    PHONE_NO

    SUB_EXTERNAL_ORDER_ITEMS

    ORDERID

    ITEMID

    QTY_ORDERED

    VENDORID

    SUB_INTERNAL_ORDER_ITEMS

    ORDERID

    ITEMID

    QTY_ORDERED

    top relationship

    secondaryrelationships

    SUB ORDER_DETAILS

    ORDERID

    CUSTID

    SHIP_DATE

    ORDER_DATE

    TOTAL_COST

    TIBCO Messaging

    demo2sub

    (Subscriber

    Adapter)

  • 7/22/2019 TIBCO adapter example

    21/90

    10 | Chapter 2 Parent/Child Exercise

  • 7/22/2019 TIBCO adapter example

    22/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    |

    Create the Tables

    1. Open a command window and change directory to the demo2directory. Forexample:

    > cd c:\tibco\adapter\adadb\\demo\demo2\

    2. Execute the demo2_databasevendor.sqlscript in the subdirectory to create thetables for your database. For example:

    > sqlplus userid/pswd@dbService@demo2_ora.sql

    The script creates the items and displays the status. For example:

    SQL*Plus: Release 8.1.7.0.0 - Production on Fri Aug 13 13:29:50

    2004

    (c) Copyright 2000 Oracle Corporation. All rights reserved.

    Connected to:

    Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production

    JServer Release 8.1.7.0.0 - Production

    Table created.

    Table created.

    Table created.

    Table created.

    Table created.

    Table created.

    Table created.

    Table created.

    Disconnected from Oracle8i Enterprise Edition Release 8.1.7.0.0 -Production

    JServer Release 8.1.7.0.0 - Production

    Configure the Properties Files |11

  • 7/22/2019 TIBCO adapter example

    23/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    |

    Configure the Properties Files

    1. Open a command window and change directory to the demo2subdirectory.For example:

    > cd c:\tibco\adapter\adadb\\demo\demo2

    2. Open the publisher adapter file, demo2pub.tra, and set the following valuesas appropriate for your environment.

    For example:

    C:\TIBCO\adapter\adadb\\demo\demo2>write demo2pub.tra#

    # Sample ADB properties file

    # Optional properties file you can use in place of command line

    parameters

    # Usage: adbagent --propFile propFilename

    ..

    Property Value

    adb.useruserId Remove the comment-out character (#) from this line.

    Use the database account name used by the adapterinstance. This is the same username entered duringTIBCO ActiveMatrix Adapter for Database installationwhen creating a database account for the adapter.

    adb.passwordpswd Remove the comment-out character (#) from this line.

    Use the database account password used by the adapterinstance. This is the same password entered during TIBCOActiveMatrix Adapter for Database installation whencreating a database account for the adapter.

    This password is not saved in the project. The globalvariable %%adb.password%%is saved instead.

    adb.dsndataSource Remove the comment-out character (#) from this line.

    Use the name of the ODBC system data source for theadapter. The data source is configured as part of theTIBCO ActiveMatrix Adapter for Databasepost-installation procedure. See the TIBCO ActiveMatrix

    Adapter for Database Installation Guidefor details.

    12 | Chapter 2 Parent/Child Exercise

  • 7/22/2019 TIBCO adapter example

    24/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    .

    # Change these settings for your login and dsn for Demo2

    adb.user karl

    adb.password karl

    adb.dsnitaska.

    .

    .

    3. Save and close the demo2pub.trafile.

    4. Open the subscriber adapter file, demo2sub.tra, and set the same values asappropriate for your environment.

    5. Save and close the demo2sub.trafile.

  • 7/22/2019 TIBCO adapter example

    25/90

  • 7/22/2019 TIBCO adapter example

    26/90

    Create an Adapter Instance |15

  • 7/22/2019 TIBCO adapter example

    27/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    3. Click Apply.

    4. Click the Design-Time Connectiontab and specify database connectionparameters for your environment. For details, see the TIBCO ActiveMatrix

    Adapter for Database Users Guide.

    If you check the Remember Passwordbox, the password is saved in theproject, and the Passwordfield will contain the masked password when youdisplay this tab.

    If it is not checked, the global variable %%adb.password%%is saved in theproject and the Passwordfield will be blank when you redisplay this tab. Youwill re-enter your password here each time you connect to the database.

    16 | Chapter 2 Parent/Child Exercise

  • 7/22/2019 TIBCO adapter example

    28/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    5. Click the Test Connectionbutton to verify the parameters you entered arecorrect for your setup.

    6. Click Apply. Click OKto any confirmation messages that appear.

    7. Click the Run-Time Connectiontab and in the ODBC DSNfield, specify ODBCsystem data source for the adapter. The data source is configured as part of theTIBCO ActiveMatrix Adapter for Database post-installation procedure. Seethe TIBCO ActiveMatrix Adapter for Database Installation Guidefor details.

    8. Click Apply.

    9. Click the Configurationtab and select Show All Tabs.

  • 7/22/2019 TIBCO adapter example

    29/90

    18 | Chapter 2 Parent/Child Exercise

  • 7/22/2019 TIBCO adapter example

    30/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    Add the Publication Service

    1. In the project panel, expand the demo2pubicon and click the AdapterServicesfolder.

    Add the Publication Service |19

  • 7/22/2019 TIBCO adapter example

    31/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    2. In the Palettespanel, drag the Publication Serviceicon to the designpanel. The icon name changes to ADBPublisher. New fields appear in theConfigurationtab. Other new tabs also appear.

    3. In the Configurationtab, Transport Typefield, select the appropriatetransport type. By default, the Rendezvoustransport type is selected.

    If you are using JMS transport, select JMSin the Transport Typefield. Thefields in the Configurationtab change.

    20 | Chapter 2 Parent/Child Exercise

  • 7/22/2019 TIBCO adapter example

    32/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    Add a Table and a Child Table to the Publication Service

    1. Click the Tabletab, then click the Add Tableicon in the tool bar.

    The Question dialog displays.

    2. Click OKto retrieve the tables from the database. A status bar displays, and theAdd Table dialog shows the available tables.

    3. Select CUSTOMERfrom the drop-down list, then click OK. TIBCO Designer loadsschema information for the CUSTOMERtable. Click Apply.

    Add a Table and a Child Table to the Publication Service |21

  • 7/22/2019 TIBCO adapter example

    33/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    4. Click the Publisher Optionstab and verify that P_CUSTOMERis set in thePublishing Tablefield. If the value is not set, type the value in the field andclick Apply.

    5. Click the Tabletab again and expand the CUSTOMERsource table.

    6. With the CUSTOMERtable highlighted, click the Add Child Tableicon in thetool bar.

    The Add Table dialog displays.

    22 | Chapter 2 Parent/Child Exercise

  • 7/22/2019 TIBCO adapter example

    34/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    7. Select ORDER_DETAILSfrom the Add Table drop-down list, then click OK.TIBCO Designer loads schema information for the ORDER_DETAILSchild table.

    8. In the Tabletab, expand the ORDER_DETAILStable.

    9. Add the join between CUSTOMERand ORDER_DETAILS:

    a. In the ORDER_DETAILSCUSTIDentry, click the User Keycheckbox. Thisentry is now marked with a key icon, like primary key columns.

    b. In the ORDER_DETAILSCUSTIDentry, click in the Join Tofield and selectCUSTOMER.CUSTIDfrom the drop-down list and click Apply.

    Add Two Child Tables to the ORDER_DETAILS Table |23

    Add T Child T bl t th ORDER DETAILS T bl

  • 7/22/2019 TIBCO adapter example

    35/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    Add Two Child Tables to the ORDER_DETAILS Table

    1. To add the first secondary table relationship, select the ORDER_DETAILStable,then click the Add Child Tableicon in the tool bar.

    The Add Table dialog displays.

    2. Select INTERNAL_ORDER_ITEMSfrom the drop-down list, then click OK. TIBCODesigner loads schema information for this secondary detail table.

    24 | Chapter 2 Parent/Child Exercise

    3 Add th j i b t ORDER DETAILS d INTERNAL ORDER ITEMS

  • 7/22/2019 TIBCO adapter example

    36/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    3. Add the join between ORDER_DETAILSand INTERNAL_ORDER_ITEMS:

    a. Expand INTERNAL_ORDER_ITEMS. (You can enlarge the configuration panelby dragging the borders.)

    b. In the INTERNAL_ORDER_ITEMSORDERIDentry, click the User Keycheckbox. This marks the entry with a key icon.

  • 7/22/2019 TIBCO adapter example

    37/90

  • 7/22/2019 TIBCO adapter example

    38/90

    Create an Adapter Instance |27

    Create an Adapter Instance

  • 7/22/2019 TIBCO adapter example

    39/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    Create an Adapter Instance

    1. Click the ADB_demo2root folder in the Project panel.2. Drag the ActiveDatabase Adapter Configurationicon from the palette

    panel to the design panel. Click OKto any confirmation messages that appear.

    New fields and tabs appear.

    3. Fill in the Configurationtab fields as follows:

    In the Instance Namefield, type demo2sub.

    In the Vendorfield, select the type of database you are using, such asOracle, from the drop-down list.

    Make sure the Write to Database on Savecheckbox is selected. Thisdefault option writes configuration information to the database when yousave the project in TIBCO Designer.

    4. Click Apply.

    5. Click the Design-time Connectiontab and specify database connectionparameters for your environment. For details, see Design-time Connection tabin the TIBCO ActiveMatrix Adapter for Database Users Guide.

    6. Click the Test Connectionbutton to verify the parameters you entered arecorrect for your setup.

    7. Click the Run-Time Connectiontab and in the ODBC DSNfield, specify theODBC system data source for the adapter. The data source is configured as

    part of the TIBCO ActiveMatrix Adapter for Database post-installation

    28 | Chapter 2 Parent/Child Exercise

    procedure. See the TIBCO ActiveMatrix Adapter for Database Installation Guide

  • 7/22/2019 TIBCO adapter example

    40/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    p p ffor details.

    8. Click Apply.

    9. Click the Configurationtab and select Show All Tabs.

    10. Click the Generaltab and in the Termination Subject or Topicfield, typedemo2sub.stop.

    11. Click Apply.

    12. Click Project>Save.

    Add the Subscription Service |29

    Add the Subscription Service

  • 7/22/2019 TIBCO adapter example

    41/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    p

    1. In the project panel, expand the demo2subicon and click the AdapterServicesfolder.

    2. In the Palettespanel, drag the Subscription Serviceicon to the designpanel. The icon name changes to ADBSubscriber.

    3. In the Configurationtab, select the appropriate transport type. By default,the Rendezvoustransport type is selected.

    If you are using the JMS transport, select JMSin the Transport Typefield.The fields in the Configurationtab change and the Advancedtab changes toJMS Advanced.

    30 | Chapter 2 Parent/Child Exercise

    Add a Table and a Child Table to the Subscription Service

  • 7/22/2019 TIBCO adapter example

    42/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    p

    1. Click the Tabletab, then click the Add Tableicon in the tool bar.The Question dialog displays.

    2. Click OKto retrieve the tables from the database. A status bar displays, and theAdd Table dialog shows the available tables.

    3. In the Add Table dialog, select SUB_CUSTOMERfrom the drop-down list, thenclick OK. TIBCO Designer loads schema information for this destination table.

    4. Expand the SUB_CUSTOMER table.

    5. Click the Add Child Tableicon in the tool bar.

    6. Select SUB_ORDER_DETAILSfrom the drop-down list, then click OK. TIBCODesigner loads schema information for this child table.

    7. Expand the SUB_ORDER_DETAILStable.

    Add a Table and a Child Table to the Subscription Service |31

    8. Add the join between SUB_CUSTOMERand SUB_ORDER_DETAILS:

  • 7/22/2019 TIBCO adapter example

    43/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    a. In the SUB_ORDER_DETAILSCUSTIDentry, click the User Keycheckbox.This entry is now marked with a key icon.

    b. In the SUB_ORDER_DETAILSCUSTIDentry, click in the Join Tofield andselect SUB_CUSTOMER.CUSTIDfrom the drop-down list.

    9. Click Apply.

    When setting a relationship on the subscription side, the columns to index mustmatch the columns indexed in the corresponding child table on the publication

    side.

    32 | Chapter 2 Parent/Child Exercise

    Add Two Child Tables to the SUB_ORDER_DETAILS Table

  • 7/22/2019 TIBCO adapter example

    44/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    1. To add the first secondary table relationship, select the SUB_ORDER_DETAILStable, then click Add Child Tablein the tool bar. The Add Tables dialogdisplays.

    2. Select SUB_INTERNAL_ORDER_ITEMSfrom the drop-down list, then click OK.

    3. Expand the SUB_INTERNAL_ORDER_ITEMStable.

    4. Add the join between SUB_ORDER_DETAILSand SUB_INTERNAL_ORDER_ITEMS:

    a. In the SUB_INTERNAL_ORDER_ITEMSORDERIDentry, click the User Keycheckbox. This entry is now marked with a key icon.

    b. In the SUB_INTERNAL_ORDER_ITEMSORDERIDentry, click in the Join Tofield and select SUB_ORDER_DETAILS.ORDERIDfrom the drop-down list.

    5. To add the second secondary table relationship, click the SUB_ORDER_DETAILStable to select it, then click Add Child Tablein the tool bar. The Add Tablesdialog displays.

    Add Two Child Tables to the SUB_ORDER_DETAILS Table |33

    6. Select SUB_EXTERNAL_ORDER_ITEMSfrom the drop-down list, then click OK.TIBCO Designer loads schema information for this secondary detail table

  • 7/22/2019 TIBCO adapter example

    45/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    TIBCO Designer loads schema information for this secondary detail table.

    a. In the SUB_EXTERNAL_ORDER_ITEMSORDERIDentry, click the User Key

    checkbox. This entry is now marked with a key icon.b. In the SUB_EXTERNAL_ORDER_ITEMSORDERIDentry, click in the Join To

    field and select SUB_ORDER_DETAILS.ORDERIDfrom the drop-down list.

    The Configuration panel should look similar to the following:

    7. Click Apply.

    8. Click Project>Save.

    34 | Chapter 2 Parent/Child Exercise

    Add Child Table Mappings

  • 7/22/2019 TIBCO adapter example

    46/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    This task adds a child table mapping for the relationship between the publishing

    and subscribing side. Child tables between a publisher and subscriber must bemapped unless the tables have the same name. If the subscriber child tables havethe same names as the publisher child tables, you do not need to perform thistask.

    1. Click the Child Table Mappingstab.

    2. Click in the Publisher Child Table Namecolumn and enter the followingdata:

    a. For the SUB_ORDER_DETAILStable, type ORDER_DETAILS.

    b. For the SUB_INTERNALORDER_ITEMStable, type INTERNAL_ORDER_ITEMS.

    c. For the SUB_EXTERNAL_ORDER_ITEMStable, type EXTERNAL_ORDER_ITEMS.

    The panel should look similar to the following diagram:

    3. Click Apply.

    4. Click the Subscriber Optionstab. In the Exception Tablefield, typeEXCP_CUSTOMER.

    This defines an exception table for use with this subscription. if an erroroccurs when inserting data, the data will be inserted into this exception table.

    5. Click Apply.

    Change the Subject Name |35

    Change the Subject Name

  • 7/22/2019 TIBCO adapter example

    47/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    The subject name must be the same for both the publication and the subscriptionservice.

    1. Click the Advancedtab. Do not change the default subject name. Copy the%%Domain%%.%%Deployment%%.adb.demo2sub.ADBSubscriber subject name.

    2. In the project tab, select the ADBPublisherservice icon, then click theAdvancedtab and paste the subject name copied in the previous step.

    3. Click Apply.

    4. Save the project using Project>Save.

    36 | Chapter 2 Parent/Child Exercise

    Export the Project

  • 7/22/2019 TIBCO adapter example

    48/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    The project must be exported toC:\tibco\adapter\adadb\\demo\demo2as a local repository.

    1. Click Project>Export Full Project.

    2. In the Export Projectdialog box, provide values for the Project Name andDir Name as shown in the next diagram.

    3. ClickOK

    .4. Click Yesin the Create Project?dialog box.

    5. Click Project>Exit.

    Start the Adapters and Insert Data into the Database |37

    Start the Adapters and Insert Data into the Database

  • 7/22/2019 TIBCO adapter example

    49/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    You are now ready to test the configuration you have just configured. To make it

    easy, a SQL script that inserts data into database tables for publishing is includedwith TIBCO ActiveMatrix Adapter for Database.

    1. If you are using TIBCO Rendezvous transport, skip to the next step.

    If you are using the JMS transport, open a command window and changedirectory to the \tibco\ems\bindirectory. Start the server. Forexample:

    c:\tibco\ems\bin>tibemsd

    2. Open a new command window and change directory to the binsubdirectory.For example:

    > cd c:\tibco\adapter\adadb\\bin

    3. Start the publisher adapter. For example:

    > adbagent --propFile

    C:\tibco\adapter\adadb\\demo\demo2\demo2

    pub.tra

    Wait until the adapter cold start completes. This can take several minutes. Youcan continue with the next step when the following message displays:

    Publication Cold start completed.

    4. In a new command window, start the subscriber adapter. For example:

    > cd c:\tibco\adapter\adadb\\bin

    > adbagent --propFileC:\tibco\adapter\adadb\\demo\demo2\demo2

    sub.tra

    5. In a new command window, execute the demo2ins_databasevendor.sqlscript.For example:

    > cd C:\tibco\adapter\adadb\\demo\demo2\

    sqlplususerid/pswd@dbService@demo2ins_ora.sql

    The script inserts data into the source table and its child tables. The adapterinstance detects that data has been added to the source table and publishes itwith child table data. Information about the transaction appears in the adapterinstance window.

    > sqlplus userid/pswd@dbService

    6. Query the database as shown:

    SQL> select * from SUB_CUSTOMER;

    38 | Chapter 2 Parent/Child Exercise

    CUSTID

    ----------

    NAME

  • 7/22/2019 TIBCO adapter example

    50/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    --------------------

    ADDRESS

    --------------------PHONE_NO

    --------------------

    CUST001

    Mickey Mouse

    1000 Disney Store

    800-555-5555

    CUSTID

    ----------

    NAME--------------------

    ADDRESS

    --------------------

    PHONE_NO

    --------------------

    CUST002

    Minnie

    2000, Walt Disney World

    800-666-6666

    SQL> select * from SUB_ORDER_DETAILS;

    ORDERID CUSTID SHIP_DATE ORDER_DAT TOTAL_COST

    ---------- ---------- --------- --------- -------

    1000 CUST001 10-OCT-03 14-OCT-03 5250.77

    1001 CUST002 10-OCT-03 20-OCT-03 7817.99

    SQL> select * from SUB_INTERNAL_ORDER_ITEMS;

    ORDERID ITEMI QTY_ORDERED---------- ----- -----------

    1000 PRN 1

    1000 SCN 2

    1001 MON 1

    1001 DISK 2

    SQL> select * from SUB_EXTERNAL_ORDER_ITEMS;

    ORDERID ITEMI QTY_ORDERED VENDORID

    ---------- ----- ----------- ----------1000 PRPAP 10 V001

    1000 PRPL 5 V002

    1001 PRPAP 10 V001

    1001 PRPL 5 V002

    Stop the Adapters and Clean Up |39

    Stop the Adapters and Clean Up

  • 7/22/2019 TIBCO adapter example

    51/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    The cleanup script removes the example tables that were created when the

    demo2_databasevendor.sqlscript was run.

    1. Exit the query tool. For example:

    SQL> exit

    2. Stop the adapter instance by typing the following command. This sends amessage on the TIBCO Rendezvous tibrvsendterminate subject.

    > tibrvsend demo2pub.stop now

    > tibrvsend demo2sub.stop now

    3. Execute the cleanup script to remove the example tables. For example:

    > sqlplus userid/pswd@dbService@demo2_cleanup_ora.sql

    40 | Chapter 2 Parent/Child Exercise

  • 7/22/2019 TIBCO adapter example

    52/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    |41

    Chapter 3 Request-Response Service Examples

  • 7/22/2019 TIBCO adapter example

    53/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    This chapter provides request-response exercises that demonstrate how to use theadapters request-response service.

    Topics

    Request-Response Exercise, page 42

    RPC Standard Operation Support Exercise, page 52

    RPC Custom Operation Support Exercise, page 62

    42 | Chapter 3 Request-Response Service Examples

    Request-Response Exercise

  • 7/22/2019 TIBCO adapter example

    54/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    This exercise uses a sample request program that emulates a request-response

    application to send requests to an adapter instance for processing.

    Overview

    The sample request program acts as a client, sending a request to be processed byan adapter instance. After receiving the request, the adapter processes it andsends a response back on its configured subject. Trace information about the

    transaction is printed in the console window where the adapter instance wasstarted.

    Required Platforms and Software

    This exercise can be performed on Microsoft Windows or on UNIX. It can beperformed with an Oracle, Microsoft SQL or Sybase database.

    You can use the following transport methods and message formats:

    TIBCO Rendezvous transport method using the TIBCO Rendezvous, TIBCOActiveEnterprise or XML message format

    JMS transport using XML message format

    All required example files are provided with the default installation of TIBCOActiveMatrix Adapter for Database.

    Visual C++ is required when using Microsoft Windows.

    Tasks

    This exercise consists of the following tasks:

    Task A, Create the Demo Tables

    Task B, Build the Sample Request Program on Windows (if applicable) Task C, Build the Sample Request Program on UNIX (if applicable)

    Task D, Configure the Properties File

    Task E, Start the Adapter

    Task F, Send a Request Message

    Task G, Stop the Adapter Instance and Clean Up

    Request-Response Exercise |43

    Exercise

    This exercise uses the Oracle database with TIBCO Rendezvous transport as anl Wh f i thi i th i t t t t

  • 7/22/2019 TIBCO adapter example

    55/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    example. When performing this exercise, use the appropriate transport type(TIBCO Rendezvous or JMS) and database vendor (as specified in theinstructions) for your environment.

    The adapter instance and request-response client used in the demo are preconfigured in the install-path\demo\request\requestDemo.dat repository.

    You will need the following information, specific to your user environment:

    Database user ID

    Database password Database service

    The names you will enter for the server and client depend on which transporttype you are using, as shown in the following table.

    Task A Create the Demo Tables

    1. Open a command window and change directory to the requestdirectory. Forexample:

    >cd c:\tibco\adapter\adadb\\demo\request

    2. Execute the appropriate request script for your database vendor to create thetables for your database. Use your environment-specific user ID, password,and database service. For example:

    >sqlplususerid/pswd@dbService@request_ora.sql

    The script creates the items and displays the status.

    3. If you have already run the demo1_databaseVendor.sqlscript (as part of aprevious exercise, for example), skip to step 5.

    If you have not yet run this script, change directory to theinstall-path\demo\demo1directory. For example:

    >cd c:\tibco\adapter\adadb\\demo\demo1

    Table 2 Values to Use for TIBCO Rendezvous and JMS Transport Types

    ItemTIBCO Rendezvous

    Transport Value

    JMS Transport

    Value

    Server rvServer jmsServer

    Client rvClient jmsClient

    44 | Chapter 3 Request-Response Service Examples

    4. Execute the appropriate demo1_databaseVendor.sqlscript to create the tablesfor your database. Use your environment-specific user ID, password, anddatabase service. For example:

  • 7/22/2019 TIBCO adapter example

    56/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    > sqlplus userid/pswd@dbService@demo1_ora.sql

    The script creates the items and displays the status.

    5. Exit the query tool.

    SQL> exit

    Task B Build the Sample Request Program on Windows (if applicable)

    Perform this task if you are running this demo on Windows. If you are running onUNIX, skip this task and go to Task C.

    1. Using Visual C++, create a new workspace and insert a new project into theworkspace.

    2. In the new project, open the appropriate sample request program for yourplatform as follows:

    For RV transport using TIBCO Rendezvous message format, use

    request.dsp. For example:

    c:\tibco\adapter\adadb\\demo\request\request.dsp

    For JMS transport or Rendezvous transport using TIBCO ActiveEnterpriseor XML message format, use aerequest.dsp. For example:

    c:\tibco\adapter\adadb\\demo\request\aerequest.dsp

    3. Select Project>Settings.

    Request-Response Exercise |45

    4. In the Project Settings dialog box, select the C/C++tab.

  • 7/22/2019 TIBCO adapter example

    57/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    a. In Category, select Preprocessor.

    b. In Additional include directories, type the path to the TIBCO

    Rendezvous includedirectory.

    c. If you are using the TIBCO ActiveEnterprise message format (that is, ifyou selected aerequest.dspin step 2), also add the TIBCO Adapter SDKincludedirectory to the Additional library path. For example:

    c:\tibco\tra\\include\sdk

    46 | Chapter 3 Request-Response Service Examples

    5. In the Project Settings dialog box, select the Linktab.

  • 7/22/2019 TIBCO adapter example

    58/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    a. In Category, select Input.

    b. In Additional library path, type the path to the TIBCO Rendezvous

    library.

    c. If you are using the TIBCO ActiveEnterprise message format (that is, ifyou selected aerequest.dspin step 2), also add the TIBCO Adapter SDKlibrarydirectory to the Additional library path. For example:

    c:\tibco\tra\\lib

    6. Click OK. The Project Settings dialog box closes.

    7. Select Build>Build name.exeto create the request executable.

    Task C Build the Sample Request Program on UNIX (if applicable)

    A sample Makefile for each UNIX platform supported is included with TIBCOActiveMatrix Adapter for Database. Use this sample Makefile as a starting pointfor your own Makefile.

    1. Using a text editor, open the MakeFileand set the RV_Homeand RVLIBSenvironment variables. For example:

    RV_HOME=/usr/tibco/tibrv

    RVLIBS= -L$(RV_HOME)/lib -ltibrvcpp -ltibrvcmq -ltibrvcm

    -ltibrv

    Request-Response Exercise |47

    2. If you are using the TIBCO Rendezvous message format, skip to step 3.

    If you are using the TIBCO ActiveEnterprise or XML wire format, set the SDKand TPCL environment variables for the TIBCO Adapter SDK. For example:

  • 7/22/2019 TIBCO adapter example

    59/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    SDK_HOME=/local/tibco/adapter/sdk/5.6

    TPCL_HOME=/local/tibco/tpcl/6.0

    SDKLIBS= -L$(SDK_HOME)/lib -L$(TPCL_HOME) -lmaverick50

    -lrepowww532 -lcrypto -lssl -lxerces-c2_1

    3. Set the system libraries. Different vendor libraries may require differentsystem libraries. (In particular, see SOCKETLIB). The config_makescript willconfigure these for most systems. Change if necessary for your system andconfiguration. For example:

    SYSTEMLIBS= -lthread -lsocket -lnsl -ldl -lm -laio -lc

    4. Set the command to invoke your compiler. For example:

    CPP= CC

    5. Set the options to be passed to your compiler. For example:

    CPPOPTIONS= -g

    6. Save the MakeFileand execute it using one of the following commands, as

    appropriate for the message format you are using:% make request

    or

    % make aerequest

    Task D Configure the Properties File

    1. Change directory to the demo\requestdirectory. For example:

    >cd c:\tibco\adapter\adadb\\demo\request

    2. Open rvServer.traor jmsServer.tra(depending on your transportmethod) and set the following values as appropriate for your environment.

    Property Value

    adb.useruserId Remove the comment-out character (#) from this line.Use the database account name used by the adapterinstance. This is the same username entered duringTIBCO ActiveMatrix Adapter for Database installationwhen creating a database account for the adapter.

    48 | Chapter 3 Request-Response Service Examples

    adb.passwordpswd Remove the comment-out character (#) from this line.

    U th d t b t d d b th d t

    Property (Contd) Value (Contd)

  • 7/22/2019 TIBCO adapter example

    60/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    For example:

    C:\TIBCO\adapter\adadb\\bin>notepad rvServer.tra#

    # Sample ADB properties file# Optional properties file you can use in place of command line

    parameters

    # Usage: adbagent --propFile propFilename.

    .

    .

    # ADB command line options

    adb.user joanne

    adb.password joanne

    adb.dsn datasource.

    .

    .

    3. Save and close the properties file.

    Task E Start the Adapter1. If you are using TIBCO Rendezvous transport, skip to step 3.

    If you are using JMS transport, open a command window and changedirectory to the \tibco\ems\bindirectory.

    2. Start the server. For example:

    tibemsd

    Use the database account password used by the adapter

    instance. This is the same password entered duringTIBCO ActiveMatrix Adapter for Database installationwhen creating a database account for the adapter.

    adb.dsndataSource Remove the comment-out character (#) from this line.

    Use the name of the ODBC system data source for theadapter. The data source is configured as part of theTIBCO ActiveMatrix Adapter for Databasepost-installation procedure. See the TIBCO ActiveMatrix

    Adapter for Database Installation Guidefor details.

    Request-Response Exercise |49

    3. Start the adapter by typing the appropriate command:

    adbagent --run --propFile rvServer.tra

    or

  • 7/22/2019 TIBCO adapter example

    61/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    adbagent --run --propFile jmsServer.tra

    Wait until the adapter cold start completes. This can take several minutes. Youcan continue with the next step when the following message displays:

    Publication Cold start completed.

    Task F Send a Request Message

    Before performing this task, make sure your environment system variablecontains the path to the required runtime library, as described in Task C.

    1. In another command window change to the directory (typically thedemo\requestdirectory) that contains the requestprogram and type theappropriate request command:

    request adb.rvrequest

    or

    aerequest -JMS|-RVXML-system:repourl requestDemo.dat

    The following options appear:

    Choose a statement:

    [1] INSERT INTO SUB_ORDER

    [2] SELECT * FROM SUB_ORDER

    [3] Execute Any SQL Statement(DDL & DML)

    [4] Execute Batch of SQL Statements

    [5] Execute SQL Stmt with Bind Variables

    [6] Execute procedure setDescription: input params[7] Execute procedure getPrice: output params

    [8] Execute procedure paramTest: multiple param types

    [0] Exit from Test Utility

    Choice:

    2. Select statement 1 to send a request to the adapter to add a row to theSUB_ORDERtable. For example:

    Choice: 1

    Enter the order_id: 973Enter the order_description: Teak table

    Enter the order_price: 899.99

    Choose One of the Following to send Request

    [1].Send Request with No Reply Name, Use Reply name from catalog [

    rv_Send() ]

    [2].Send Request with A Reply Name Subject [ rv_SendWithReply()

    ]

    [3].Send Request with A Inbox Reply Name [ rv_Rpc() ]

    50 | Chapter 3 Request-Response Service Examples

    request: { stmt={ sql="INSERT INTO SUB_ORDER (order_id,

    order_description, order_price) VALUES (973, 'Teak table',

    899.990000)"}}

    reply: subject=_INBOX.A0651B78.1C3380DF4408C1D70.2,

  • 7/22/2019 TIBCO adapter example

    62/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    j

    reply=, message={ status=0}

    Statement executed.

    You can use the sample request program to demonstrate other features, such as

    returning the rows in theSUB_ORDER

    table, batching requests, binding time andbinary values, or executing other SQL commands.

    The next table explains the selections available in the sample request program.

    Do not use quotation marks when entering the order_description value. Theprogram will add the quotes automatically, if needed.

    Selection Description

    [1] INSERT INTOSUB_ORDER

    Send a request to the adapter to update the SUB_ORDERtable. You are prompted to provide the order id, description

    and price. For example:Enter the order_id: 908

    Enter the order_description: 'Oak Table'

    Enter the order_price: 865.99

    [2] SELECT * FROMSUB_ORDER

    Send a request to the adapter to return all rows from theSUB_ORDERtable.

    [3] Execute Any SQLStatement (DDL &DML)

    Construct a custom request and send it to the adapter usingan INSERT, UPDATE or DELETE statement.

    [4] Execute Batch ofSQL Statements

    Send a request to the adapter to execute two update and twoselect statements as a batch operation.

    [5] Execute SQL Stmtwith Bind Variables

    Send an INSERT statement to the adapter to update theREPLYTEST table. You are prompted to provide the id as an

    integer, timestamp in the form YYYY-MM-DD HH24:MI:SSand a binary value (can be any value). For example:

    Enter the id: 24

    Enter the timestamp: 1999-11-23 02:32:06

    Enter the binary: test

  • 7/22/2019 TIBCO adapter example

    63/90

    52 | Chapter 3 Request-Response Service Examples

    RPC Standard Operation Support Exercise

    This is the first of two RPC exercises. The second exercise, RPC Custom Operation

  • 7/22/2019 TIBCO adapter example

    64/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    p

    Support Exercise on page 62, demonstrates custom operation support.

    Overview

    This exercise demonstrates standard operation support. It uses a sampleoperation program that emulates an RPC client application to send requests to anadapter instance for processing.

    Required Platforms and Software

    This exercise can be performed on Microsoft Windows or on UNIX. It can beperformed with an Oracle, Microsoft SQL or Sybase database.

    All required files are provided with the default installation of the adapter.

    The source code for the sample operation program is included in theinstall-path\demo\operationdirectory. The program must be built for yourplatform. It is similar to the sample request-response program used in theRequest-Response Exercise.

    The following software is required:

    Visual C++

    TIBCO Designer

    TIBCO IntegrationManager

    TIBCO Adapter SDK

    Tasks

    This exercise consists of the following tasks:

    Task A, Create the Demo Tables

    Task B, Build the Sample Operation Program on Windows (if applicable)

    Task C, Build the Sample Request Program on UNIX (if applicable)

    Task D, Configure the Properties File

    Task E, Start the Adapter

    Task F, Send a Request Message

    RPC Standard Operation Support Exercise |53

    Task G, Stop the Adapter Instance and Clean Up

    Exercise

  • 7/22/2019 TIBCO adapter example

    65/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    This exercise uses the example of an Oracle database with TIBCO Rendezvoustransport. During the exercise, follow the instructions that pertain to yourparticular database vendor.

    You can use either of the following transport and wire format combinations:

    TIBCO Rendezvous message transport with TIBCO ActiveEnterprise wireformat

    JMS message transport with XML wire formatThe names you will enter for the server and client depend on which transporttype you are using, as shown in the following table.

    You will need the following information, specific to your user environment:

    Database user ID

    Database password Database service

    Task A Create the Demo Tables

    1. If you have already run the demo1_databaseVendor.sqlscript (as part of aprevious exercise, for example), skip to step 3.

    If you have not yet run this script, change directory to theinstall-path\demo\demo1directory. For example:

    >cd c:\tibco\adapter\adadb\\demo\demo1

    2. Execute the appropriate demo1_databaseVendor.sqlscript to create the tablesfor your database. Use your environment-specific user ID, password, anddatabase service. For example:

    > sqlplus userid/pswd@dbService@demo1_ora.sql

    Table 3 Values to Use for TIBCO Rendezvous and JMS Transport Types

    ItemTIBCO RendezvousTransport Value

    JMS TransportValue

    Server rvServer jmsServer

    Client rvClient jmsClient

    54 | Chapter 3 Request-Response Service Examples

    The script creates the items and displays the status.

    3. Open a command window and change directory to the operationdirectory.For example:

    >cd C:\tibco\adapter\adadb\demo\operation

  • 7/22/2019 TIBCO adapter example

    66/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    >cd C:\tibco\adapter\adadb\demo\operation

    4. Execute the appropriate request script for your database vendor to create thetables for your database. Use your environment-specific user ID, password,and database service. For example:

    >sqlplususerid/pswd@dbService@operation_ora.sql

    The script creates the items and displays the status.

    5. Exit the query tool.

    SQL> exit

    Task B Build the Sample Operation Program on Windows (if applicable)

    Perform this task if you are running this demo on Windows. If you are running onUNIX, skip this task and go to Task C.

    1. In Visual C++, create a new workspace and insert a new project into it.

    2. In the new project, open the appropriate sample operation program for yourplatform. For example:

    c:\tibco\adapter\adadb\\demo\operation\operation.dsp

    3. Select Project>Settings.

    RPC Standard Operation Support Exercise |55

    4. In the Project Settings dialog box, select the C/C++tab and make the followingchanges:

    a. In Category, select Preprocessor.

    Additional include directories

  • 7/22/2019 TIBCO adapter example

    67/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    b. InAdditional include directories

    , type the paths to the followingdirectories:

    TIBCO Rendezvous includedirectory

    TIBCO Adapter SDK includedirectory

    56 | Chapter 3 Request-Response Service Examples

    5. In the Project Settings dialog box, select the Linktab and make the followingchanges:

    a. In the Categoryfield, select Input.

    Additional library path

  • 7/22/2019 TIBCO adapter example

    68/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    b. InAdditional library path

    , type the path to the TIBCO Rendezvouslibrary and the TIBCO Adapter SDK includedirectory.

    6. Click OK. The Project Settings dialog box closes.

    7. Select Build>Build name.exeto create the operation executable.

    Task C Build the Sample Request Program on UNIX (if applicable)

    A sample Makefile for each supported UNIX platform is in theinstall-path/demo/operationdirectory. Use the appropriate Makefile for youroperating system as a starting point for this exercise.

    1. Using a text editor, open the MakeFileand set the RV_Homeand RVLIBSenvironment variables. For example:

    RV_HOME=/usr/tibco/tibrv

    RVLIBS= -L$(RV_HOME)/lib -ltibrvcpp -ltibrvcmq -ltibrvcm

    -ltibrv

    2. Set the SDK_HOMEand SDKLIBSenvironment variables for the TIBCO AdapterSDK. For example:

    SDK_HOME=/local/activedb/sdk50

    SDKLIBS= -L$(SDK_HOME)/lib -lmaverick50 -lrepowww532 -lcrypto

    -lssl -lxerces-c2_1

    3. Set the system libraries. Different vendor libraries may require differentsystem libraries. (In particular, see SOCKETLIB). The config_makescript will

    RPC Standard Operation Support Exercise |57

    configure these for most systems. Change if necessary for your system andconfiguration. For example:

    SYSTEMLIBS= -lthread -lsocket -lnsl -ldl -lm -laio -lc

    4. Set the command to invoke your compiler. For example:

  • 7/22/2019 TIBCO adapter example

    69/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    CPP= CC

    5. Set the options to be passed to your compiler. For example:

    CPPOPTIONS= -g

    6. Save the MakeFileand execute it:

    % make operation

    Task D Configure the Properties File

    1. Open rvServer.traor jmsServer.tra(depending on your transportmethod) and set the following values as appropriate for your environment.

    Property Value

    adb.useruserId Remove the comment-out character (#) from this line.

    Use the database account name used by the adapterinstance. This is the same username entered duringTIBCO ActiveMatrix Adapter for Database installationwhen creating a database account for the adapter.

    adb.passwordpswd Remove the comment-out character (#) from this line.

    Use the database account password used by the adapter

    instance. This is the same password entered duringTIBCO ActiveMatrix Adapter for Database installationwhen creating a database account for the adapter.

    adb.dsndataSource Remove the comment-out character (#) from this line.

    Use the name of the ODBC system data source for theadapter. The data source is configured as part of theTIBCO ActiveMatrix Adapter for Databasepost-installation procedure. See the TIBCO ActiveMatrix

    Adapter for Database Installation Guidefor details.

    58 | Chapter 3 Request-Response Service Examples

    For example:

    C:\tibco\adapter\adadb\\demo\operation>notepadrvServer.tra

  • 7/22/2019 TIBCO adapter example

    70/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    ## Sample ADB properties file

    # Optional properties file you can use in place of command line

    parameters

    # Usage: adbagent --propFile propFilename.

    .

    .

    # ADB command line options

    adb.user joanne

    adb.password joanneadb.dsn datasource.

    .

    .

    2. Save and close the properties file.

    Task E Start the Adapter

    1. Open a command window and change directory to the\tibco\ems\bindirectory.

    2. Start the JMS daemon. For example:

    tibemsd

    3. Start the adapter from the adapter bin directory:

    adbagent --run --propFile

    C:\tibco\adapter\adadb\\demo\operationrvServer.tra

    or

    adbagent --run --propFile

    C:\tibco\adapter\adadb\\demo\jmsServer.tra

    Wait until the adapter cold start completes. This can take several minutes. Youcan continue with the next step when the following message displays:

    Publication Cold start completed.

    RPC Standard Operation Support Exercise |59

    Task F Send a Request Message

    The sample operation program allows you to send a request message to anadapter instance, which processes the request and sends a message back to thesample program. Use the sample program to interactively demo request-response

    f t i MO ati n

  • 7/22/2019 TIBCO adapter example

    71/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    features using MOperation.

    Before performing this task, make sure your environment system variablecontains the path to the required runtime library, as described in Task C.

    1. In another command window, change to the install-path\demo\operationdirectory and type the appropriate command as shown:

    for TIBCO Rendezvous transport:

    operation -system:repourl operationDemo.dat

    for JMS transport:

    operation -JMS -system:repourl operationDemo.dat

    The following options appear:

    Choose a statement:

    [1] INSERT INTO SUB_ORDER

    [2] SELECT * FROM SUB_ORDER

    [3] Execute Any SQL Statement(DDL & DML)[4] Execute Batch of SQL Statements

    [5] Execute SQL Stmt with Bind Variables

    [6] Execute procedure setDescription: input params

    [7] Execute procedure getPrice: output params

    [8] Execute procedure paramTest: multiple param types

    [0] Exit from Test Utility

    Choice:

    2. Select statement 6 to send a request to the adapter to execute the

    setDescriptionprocedure. This procedure, defined in operation.cpp,takes an input parameter to set the order_descriptionvalue. The valuemust be enclosed within quotation marks. For example:

    Choice: 6

    Enter the id: 3

    Enter the order_description: 'sample'

    Received reply:

    {/tibco/public/class/ae/ADB/adbmetadata/SQL_RETURN {STATUS,

    /tibco/public/scalar/ae/string, "SUCCESS"}

    {SQL, /tibco/public/scalar/ae/string, "{call setDescription(?,

    ?)}"}}

    Status = SUCCESS

    You can also use the sample operation program to execute the getPriceprocedure, which returns the price value for a specified order_id. TheparamTestprocedure includes input parameters, output parameters and

    input/output parameters.

    60 | Chapter 3 Request-Response Service Examples

    The next table explains the selections available in the sample operation program.

    Selection Description

    [1] INSERT INTO

    SUB ORDER

    Send a request to the adapter to update the SUB_ORDER

    table You are prompted to provide the order ID

  • 7/22/2019 TIBCO adapter example

    72/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    SUB_ORDER table. You are prompted to provide the order ID,description, and price. For example:

    Enter the order_id: 908

    Enter the order_description: 'Oak Table'

    Enter the order_price: 865.99

    [2] SELECT * FROMSUB_ORDER

    Send a request to the adapter to return all rows from theSUB_ORDERtable.

    [3] Execute Any SQLStatement (DDL & DML)

    Construct a custom request and send it to the adapter usingan INSERT, UPDATE or DELETE statement.

    [4] Execute Batch of SQLStatements

    Send a request to the adapter to execute two update andtwo select statements as a batch operation.

    [5] Execute SQL Stmtwith Bind Variables

    Send an INSERT statement to the adapter to update theREPLYTEST table. You are prompted to provide the id as

    an integer, timestamp in the form YYYY-MM-DDHH24:MI:SS and a binary value (can be any value). Forexample:

    Enter the id: 24

    Enter the timestamp: 1999-11-23 02:32:06

    Enter the binary: test

    [6] Execute proceduresetDescription: inputparams

    Execute the setDescription procedure, which takes an itemdescription as input and writes it to the SUB_ORDER table.For example:

    Enter the id: 24

    Enter the order_description: Pine Chair

    [7] Execute proceduregetPrice: output params

    Execute the getPrice procedure, which returns an item pricefor the specified id. For example:

    Enter the id: 24

    Returns the price value for the specified order.

  • 7/22/2019 TIBCO adapter example

    73/90

  • 7/22/2019 TIBCO adapter example

    74/90

    RPC Custom Operation Support Exercise |63

    Exercise

    This exercise uses the Oracle database with TIBCO Rendezvous transport as anexample. When performing this exercise, use the appropriate transport type(TIBCO Rendezvous or JMS) and database vendor (as specified in the

    instructions) for your environment.

  • 7/22/2019 TIBCO adapter example

    75/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    st uct o s) o you e o e t

    You will need the following information, specific to your user environment:

    Database user ID

    Database password

    Database service

    The names you will enter for the server and client depend on which transporttype you are using, as shown in the following table.

    Task A Create the Demo Tables

    1. If you have already run the demo1_databaseVendor.sqlscript (as part of aprevious exercise, for example), skip to step 3.

    If you have not yet run this script, change directory to theinstall-path\demo\demo1directory. For example:

    > cd c:\tibco\adapter\adadb\\demo\demo1

    2. Execute the appropriate demo1_databaseVendor.sqlscript to create the tablesfor your database. Use your environment-specific user ID, password, anddatabase service. For example:

    > sqlplus userid/pswd@dbService@demo1_ora.sqlThe script creates the items and displays the status.

    3. Open a command window and change directory to the operationdirectory.For example:

    > cd c:\tibco\adapter\adadb\\demo\operation

    Table 4 Values to Use for TIBCO Rendezvous and JMS Transport Types

    ItemTIBCO RendezvousTransport Value

    JMS TransportValue

    Server rvServer jmsServer

    Client rvClient jmsClient

    64 | Chapter 3 Request-Response Service Examples

    4. Execute the appropriate request script for your database vendor to create thetables for your database. Use your environment-specific user ID, password,and database service. For example:

    > sqlplususerid/pswd@dbService@operation_ora.sql

    The script creates the items and displays the status.

  • 7/22/2019 TIBCO adapter example

    76/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    p p y

    5. Exit the query tool.

    SQL> exit

    Task B Configure the TIBCO IntegrationManager Client

    1. In the TIBCO IntegrationManager Editor, open the file

    install-path\demo\operation\operationDemoIM.dat .

    RPC Custom Operation Support Exercise |65

    2. Open the Process Diagram named ADBIMProcess.

  • 7/22/2019 TIBCO adapter example

    77/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    66 | Chapter 3 Request-Response Service Examples

    3. Open the Mapper Task named Set Input Parameters. The Mapper TaskEdit Dialog appears.

  • 7/22/2019 TIBCO adapter example

    78/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    4. Set the input parameter value of the procedure.5. Click OK. The Mapper Task Edit dialog closes.

    6. Click File>Saveto save the repository.

    RPC Custom Operation Support Exercise |67

    Task C Configure the Properties File

    1. Open rvServer.traor jmsServer.traand set the following values asappropriate for your environment.

    Property Value

  • 7/22/2019 TIBCO adapter example

    79/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    For example:

    C:\tibco\adapter\adadb\\demo\operation>notepadrvServer.tra

    #

    # Sample ADB properties file

    # Optional properties file you can use in place of command line

    parameters

    # Usage: adbagent --propFile propFilename.

    .

    .

    # ADB command line options

    adb.user joanne

    adb.password joanne

    adb.dsn dataSource.

    .

    .

    adb.useruserId Remove the comment-out character (#) from this line.

    Use the database account name used by the adapterinstance. This is the same username entered duringTIBCO ActiveMatrix Adapter for Database installationwhen creating a database account for the adapter.

    adb.passwordpswd Remove the comment-out character (#) from this line.

    Use the database account password used by the adapterinstance. This is the same password entered duringTIBCO ActiveMatrix Adapter for Database installationwhen creating a database account for the adapter.

    adb.dsndataSource Remove the comment-out character (#) from this line.

    Use the name of the ODBC system data source for theadapter. The data source is configured as part of theTIBCO ActiveMatrix Adapter for Databasepost-installation procedure. See the TIBCO ActiveMatrix

    Adapter for Database Installation Guidefor details.

    68 | Chapter 3 Request-Response Service Examples

    2. Save and close the properties file.

    Task D Start the Adapter

    1. Open a command window and change directory to the\tibco\ems\bindirectory.

  • 7/22/2019 TIBCO adapter example

    80/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    2. Start the JMS server. For example:

    tibemsd

    3. Start the adapter from the adapter bin directory:

    adbagent --run --propFile

    C:\tibco\adapter\adadb\\demo\operation\rvS

    erver.tra

    Wait until the adapter cold start completes. This can take several minutes. Youcan continue with the next step when the following message displays:

    Publication Cold start completed.

    Task E Send a Request Message

    1. Start the TIBCO IntegrationManager Engine by typing:

    imse -name clientinstall-path\demo\operation\operationDemoIM.dat

    2. In another console window, use tibrvsendto send a message with the subjectADB.IM:

    tibrvsend ADB.IM start

    The TIBCO IntegrationManager Engine invokes the task "Send RPC Request" andsend a RPC request to the adapter to execute the stored procedure.

    The adapter sends back a reply which is displayed in the client console. Forexample:

    ********************************* IM RPC Client *********************************

    Job-17200{

    ADBServer1_OPS= class ^request^ADBServer1_OPS^GETPRICE {

    REQUEST= class ae/ADB/CustomOps/rvServer/ADBServer1/GETPRICE/REQUEST {

    INBINDS= class ae/ADB/CustomOps/rvServer/ADBServer1/GETPRICE/INPUT_BINDS{

    ID=1.0 (java.lang.Double)

    }

    }

    }

    reply={

    __returnValue__= class ae/ADB/CustomOps/rvServer/ADBServer1/GETPRICE/REPLY {

    STATUS=SUCCESS (java.lang.String)

    OUTBINDS= class

    ae/ADB/CustomOps/rvServer/ADBServer1/GETPRICE/OUTPUT_BINDS {

    RPC Custom Operation Support Exercise |69

    PRICE=1.0 (java.lang.Double)

    }

    }

    }

    }

    ******************** Received successful reply from the Server ******************

  • 7/22/2019 TIBCO adapter example

    81/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    Task F Stop the Adapter Instance and Clean Up

    The clean up script removes only the example tables that were created when theoperation.sqlscript was run.

    1. Use the TIBCO Rendezvous tibrvsendapplication to send a message on theterminate subject to stop the adapter instance. Type the appropriate messagein a command window:

    for TIBCO Rendezvous transport:

    tibrvsend _ADB.rvServer.TERMINATE now

    for JMS transport:

    tibrvsend _ADB.jmsServer.TERMINATE now

    2. Change directory to the operationdirectory. For example:

    cd c:\tibco\adapter\adadb\\demo\operation

    3. Execute the demo cleanup script to remove the example tables. For example:

    sqlplus userid/pswd@dbService@operation_cleanup_ora.sql

    70 | Chapter 3 Request-Response Service Examples

  • 7/22/2019 TIBCO adapter example

    82/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

  • 7/22/2019 TIBCO adapter example

    83/90

  • 7/22/2019 TIBCO adapter example

    84/90

  • 7/22/2019 TIBCO adapter example

    85/90

    74 | Chapter 4 TIBCO ActiveMatrix BusinessWorks: Processing a Sales Order

    2. Start the JMS server. For example: tibemsd

  • 7/22/2019 TIBCO adapter example

    86/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

  • 7/22/2019 TIBCO adapter example

    87/90

    76 | Chapter 4 TIBCO ActiveMatrix BusinessWorks: Processing a Sales Order

    Expected Results

    After running the example, the sales order is changed to contain only the validsales items. The priority assigned to each valid sales item is also changed.

    A query of the original sales order shows the following entries:

    l HEADER NUMBER PRIORITY SHIP NOTE f SO HEADER

  • 7/22/2019 TIBCO adapter example

    88/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    select HEADER_NUMBER, PRIORITY, SHIP_NOTE from SO_HEADER;

    1-1ABXYZ 2 Regular Shipping

    select HEADER_NUMBER, LINE_NUMBER, SHIPPING_NOTE from SO_LINE;

    1-1ABXYZ L-1ABXYZ Regular

    1-1ABXYZ L-2ABXYZ Regular

    1-1ABXYZ L-3ABXYZ Regular

    After running the example, a query of the changed sales order shows thefollowing results:

    select HEADER_NUMBER, PRIORITY, SHIP_NOTE from NEW_SO_HEADER;

    1-1ABXYZ 1 Express Shipping

    select HEADER_NUMBER, SHIPPING_NOTE from NEW_SO_LINE;

    1-1ABXYZ L-1ABXYZ Urgent

    1-1ABXYZ L-2ABXYZ Urgent

    Run the Database Clean up Script |77

    Run the Database Clean up Script

    The cleanup script removes the example tables that were created when theSalesOrder_databasevendor.sqlscript was run.

    1. Change directory to the salesOrderDemodirectory.

    cd C:\tibco\adapter\adadb\\demo\salesOrderDemo\

  • 7/22/2019 TIBCO adapter example

    89/90

    TIBCO ActiveMatrix Adapter for Database Examples Guide

    cd C:\tibco\adapter\adadb\\demo\salesOrderDemo\

    2. Execute the demo cleanup script to remove the example tables.

    sqlplus userid/pswd@dbService@deleteSalesOrder_ora.sql

    3. Clean up the database objects.

    sqlplus userid/pswd@dbService@salesOrder_cleanup_ora.sql

    78 | Chapter 4 TIBCO ActiveMatrix BusinessWorks: Processing a Sales Order

  • 7/22/2019 TIBCO adapter example

    90/90

    TIBCO ActiveMatrix Adapter for D