Using the Caché SQL Gateway



Similar documents
Using the Studio Source Control Hooks

Identifying Memory Fragmentation within the Microsoft IIS Environment

Caché License Management

Caché Integration with a Network Appliance Filer

Using Encrypted File Systems with Caché 5.0

Try-Catch FAQ. Version February InterSystems Corporation 1 Memorial Drive Cambridge MA

Ensemble X12 Development Guide

How To Use Deepsee

Developing Ensemble Productions

Creating a System DSN for Crystal Reports to Access a Sentinel Server Database. Configuration Guide Version 1.0

PowerSchool Student Information System

Monitoring Ensemble. Version March InterSystems Corporation 1 Memorial Drive Cambridge MA

Using the Caché Objective-C Binding

Creating SOAP and REST Services and Web Clients with Ensemble

Caché Data Integrity Guide

TaskCentre v4.5 Run Crystal Report Tool White Paper

MySQL Installer Guide

Working with the Cognos BI Server Using the Greenplum Database

Using Caché with ODBC

ODBC Driver User s Guide. Objectivity/SQL++ ODBC Driver User s Guide. Release 10.2

Caché Security Administration Guide

Start Oracle Insurance Policy Administration. Activity Processing. Version

Installing the Shrew Soft VPN Client

HYPERION SYSTEM 9 N-TIER INSTALLATION GUIDE MASTER DATA MANAGEMENT RELEASE 9.2

FileMaker 11. ODBC and JDBC Guide

Simba ODBC Driver with SQL Connector for Apache Cassandra

IBM Rational Rhapsody Gateway Add On. CaliberRM Coupling Notes

Changes for Release 3.0 from Release 2.1.1

Set Up Hortonworks Hadoop with SQL Anywhere

ALTIRIS Notification Connector Configuration Guide

Installing RMFT on an MS Cluster

Using Workflow with Ensemble

Adaptive Server Enterprise

An Oracle White Paper March Oracle Label Security in Government and Defense Environments

Dell Statistica Statistica Enterprise Installation Instructions

How To Set Up Chime For A Coworker On Windows (Windows) With A Windows 7 (Windows 7) On A Windows 8.1 (Windows 8) With An Ipad (Windows).Net (Windows Xp

Technical Paper. Defining an ODBC Library in SAS 9.2 Management Console Using Microsoft Windows NT Authentication

FileMaker 12. ODBC and JDBC Guide

Siebel Installation Guide for Microsoft Windows. Siebel Innovation Pack 2013 Version 8.1/8.2, Rev. A April 2014

Setting Up ALERE with Client/Server Data

Plug-In for Informatica Guide

Disaster Recovery. Websense Web Security Web Security Gateway. v7.6

Quick Connect Express for Active Directory

Tutorial: Mobile Business Object Development. Sybase Unwired Platform 2.2 SP02

The purpose of this document is to describe how to connect Crystal Reports with BMC Remedy AR System using ODBC.

How To Install Help Desk Premier

QuadraMed Enterprise Scheduling Combined Service Installation Guide. Version 11.0

Introduction to Virtual Datacenter

An Oracle White Paper May Creating Custom PDF Reports with Oracle Application Express and the APEX Listener

NEW FEATURES ORACLE ESSBASE STUDIO

AvePoint SearchAll for Microsoft Dynamics CRM

Tutorial: Mobile Business Object Development. SAP Mobile Platform 2.3

Siebel Installation Guide for UNIX. Siebel Innovation Pack 2013 Version 8.1/8.2, Rev. A April 2014

Business Portal for Microsoft Dynamics GP. Project Time and Expense Administrator s Guide Release 10.0

Policy Based Encryption Essentials. Administrator Guide

Oracle Enterprise Manager. 1 Introduction to SAP Monitoring with Oracle Enterprise Manager Grid Control. 1.1 Overview

Caché System Administration Guide

SAP Operational Process Intelligence Security Guide

OpenLDAP Oracle Enterprise Gateway Integration Guide

Oracle Enterprise Manager

1 Changes in this release

Accounts Payable Workflow Guide. Version 11.2

Installing SQL Express. For CribMaster 9.2 and Later

Caché System Administration Guide

Using Caché Server Pages (CSP)

Oracle Fusion Middleware

Setting up SQL Translation Framework OBE for Database 12cR1

PrintFleet Local Beacon

DiskPulse DISK CHANGE MONITOR

DataFlex Connectivity Kit For ODBC User's Guide. Version 2.2

AvePoint Tags 1.1 for Microsoft Dynamics CRM. Installation and Configuration Guide

Oracle Primavera Gateway

Netwrix Auditor. Administrator's Guide. Version: /30/2015

Silect Software s MP Author

PaperClip Audit System Installation Guide

ACT! by Sage. Premium for Workgroups 2007 (9.0) Administrator s Guide to the ACT! Reader Utility

An Oracle White Paper June Security and the Oracle Database Cloud Service

Report Writer's Guide Release 14.1

Microsoft Dynamics GP. econnect Installation and Administration Guide Release 9.0

Caché Data Integrity Guide

AvePoint SearchAll for Microsoft Dynamics CRM

Installing the BlackBerry Enterprise Server Management Software on an administrator or remote computer

Copyright

Tutorial: Mobile Business Object Development. SAP Mobile Platform 2.3 SP02

FileMaker 13. ODBC and JDBC Guide

Microsoft Dynamics GP. Audit Trails

Ontrack PowerControls User Guide Version 8.1

Contents Legal Notices... 2 Preface... 5 Introduction... 7 Installation Instructions... 8

About Contract Management

Horizon Debt Collect. User s and Administrator s Guide

Installing Sage SalesLogix on Microsoft Windows 8, Windows Server 2012, and Internet Explorer 10 Version Developed by Sage SalesLogix User

About Recovery Manager for Active

2. Unzip the file using a program that supports long filenames, such as WinZip. Do not use DOS.

Instant Chime for IBM Sametime For IBM Websphere and IBM DB2 Installation Guide

CSP Gateway Configuration Guide

Synchronization Agent Configuration Guide

SimbaEngine SDK 9.4. Build a C++ ODBC Driver for SQL-Based Data Sources in 5 Days. Last Revised: October Simba Technologies Inc.

Mimer SQL. Getting Started on Windows. Version 10.1

QAD Enterprise Applications. Training Guide Demand Management 6.1 Technical Training

Transcription:

Using the Caché SQL Gateway Version 2007.1 04 June 2007 InterSystems Corporation 1 Memorial Drive Cambridge MA 02142 www.intersystems.com

Using the Caché SQL Gateway Caché Version 2007.1 04 June 2007 Copyright 2007 InterSystems Corporation All rights reserved. This book was assembled and formatted in Adobe Page Description Format (PDF) using tools and information from the following sources: Sun Microsystems, RenderX, Inc., Adobe Systems, and the World Wide Web Consortium at www.w3c.org. The primary document development tools were special-purpose XML-processing applications built by InterSystems using Caché and Java. and Caché WEBLINK, Distributed Cache Protocol, M/SQL, N/NET, and M/PACT are registered trademarks of InterSystems Corporation. and InterSystems Jalapeño Technology, Enterprise Cache Protocol, ECP, and InterSystems Zen are trademarks of InterSystems Corporation. All other brand or product names used herein are trademarks or registered trademarks of their respective companies or organizations. This document contains trade secret and confidential information which is the property of InterSystems Corporation, One Memorial Drive, Cambridge, MA 02142, or its affiliates, and is furnished for the sole purpose of the operation and maintenance of the products of InterSystems Corporation. No part of this publication is to be used for any other purpose, and this publication is not to be reproduced, copied, disclosed, transmitted, stored in a retrieval system or translated into any human or computer language, in any form, by any means, in whole or in part, without the express prior written consent of InterSystems Corporation. The copying, use and disposition of this document and the software programs described herein is prohibited except to the limited extent set forth in the standard software license agreement(s) of InterSystems Corporation covering such programs and related documentation. InterSystems Corporation makes no representations and warranties concerning such software programs other than those set forth in such standard software license agreement(s). In addition, the liability of InterSystems Corporation for any losses or damages relating to or arising out of the use of such software programs is limited in the manner set forth in such standard software license agreement(s). THE FOREGOING IS A GENERAL SUMMARY OF THE RESTRICTIONS AND LIMITATIONS IMPOSED BY INTERSYSTEMS CORPORATION ON THE USE OF, AND LIABILITY ARISING FROM, ITS COMPUTER SOFTWARE. FOR COMPLETE INFORMATION REFERENCE SHOULD BE MADE TO THE STANDARD SOFTWARE LICENSE AGREEMENT(S) OF INTERSYSTEMS CORPORATION, COPIES OF WHICH WILL BE MADE AVAILABLE UPON REQUEST. InterSystems Corporation disclaims responsibility for errors which may appear in this document, and it reserves the right, in its sole discretion and without notice, to make substitutions and modifications in the products and practices described in this document. For Support questions about any InterSystems products, contact: InterSystems Worldwide Customer Support Tel: +1 617 621-0700 Fax: +1 617 374-9391 Email: support@intersystems.com

Table of Contents 1 Introduction... 1 2 Architecture... 3 2.1 The Connection Manager... 3 2.2 The SQL Gateway API... 3 2.3 The External Table Query Processor... 4 2.4 SQL Storage Class... 4 3 Configuration... 5 3.1 Creating an SQL Gateway Connection... 5 4 Using the SQL Gateway... 7 4.1 Using the Link Table Wizard... 7 4.2 Debugging Any Gateway Problems... 8 5 Restrictions... 11 Using the Caché SQL Gateway iii

List of Figures Using the SQL Gateway to View External Data... 1 iv Using the Caché SQL Gateway

1 Introduction The Caché SQL Gateway, in conjunction with Caché Objects, provides object access to data stored in a relational database management system (RDBMS) outside of (or external to) Caché. Using the SQL Gateway, applications can: Access data stored in third-party relational databases within Caché applications using objects and/or SQL queries. Store persistent Caché objects in external relational databases. For example, suppose you have an Employee table stored within an external relational database. You can use this table within Caché as an object by creating (or letting the Caché Link Table Wizard create for you) an Employee class that communicates (by executing SQL queries via ODBC) with the external database. This is illustrated below: Using the SQL Gateway to View External Data Using the Caché SQL Gateway 1

Introduction From the perspective of a Caché application, the Employee class behaves in much the same way as any other persistent class: You can open instances, modify, and save them. If you issue SQL queries against the Employee class, they are automatically dispatched to the external database. The use of the SQL Gateway is independent of application logic; an application can be modified to switch between external databases and the built-in Caché database with minimal effort and no change to application logic. Classes using the SQL Gateway to provide object persistence are identical in usage to those using native persistence and can make full use of Caché features including Java, ActiveX, SQL, and Web access. 2 Using the Caché SQL Gateway

2 Architecture The SQL Gateway consists of the following components. The Connection Manager The SQL Gateway API The External Table Query Processor SQL Storage Class These are described in the following sections. 2.1 The Connection Manager The Connection Manager is a list of logical connection definitions maintained by Caché. Each connection definition associates an external database with a logical name used by Caché. The SQL Gateway uses these logical names to determine how to establish a connection with a specific external database. For more details, see SQL Gateway Connections. 2.2 The SQL Gateway API The SQL Gateway API is a set of functions used by a Caché program to communicate with a thirdparty RDBMS. These functions are implemented by means of a shared library, also known as a Dynamically Linked Library (DLL). This shared library is responsible for establishing an ODBC connection with an external database, making the appropriate calls to the external ODBC interface, Using the Caché SQL Gateway 3

Architecture and performing any data conversions that may be required. When connecting to an external database using the SQL Gateway API, a Caché program has access to that portion of the ODBC API that allows it to execute those queries supported by the gateway. 2.3 The External Table Query Processor The External Table Query Processor is an extension to the Caché SQL Query Processor that handles queries targeted at external tables. Caché maintains a list of all defined SQL tables within what is called the SQL Dictionary. A given table is marked as external when its data is stored in a third-party RDBMS. When the Caché SQL Query Processor detects that the table (or tables) referenced within an SQL query are external, it invokes the External Table Query Processor which generates a query execution plan by means of SQL Gateway API calls instead of accessing data stored within Caché. It is the integration within the internal workings of the Caché SQL Engine that provides the SQL Gateway with its transparency; since any object or SQL-based request automatically accesses the correct storage location, applications can be written independently of the actual data storage used. 2.4 SQL Storage Class All object persistence in Caché is provided by means of a storage class. A storage class generates the code needed to save and retrieve a persistent object within a database. The SQL Storage class (%Caché.SQLStorage) is a special purpose storage class that provides object persistence by means of specially-generated SQL queries. Typically, this SQL provides storage within the Caché database in cases where an application needs finer control over storage structures than is provided by the default, Caché Storage storage class. A class using the SQL Storage Class for persistence indicates that it is an external class by providing a value for its CONNECTION and EXTERNALTABLENAME class parameters. When such a class is compiled, the Class Compiler does the following: It creates an SQL table definition for the class. This table is marked as external and is associated with the SQL Gateway connection specified by the class' CONNECTION class parameter. The name of the table in the external database is specified by the EXTERNALTABLENAME class parameter. It generates object persistence code for the class using SQL queries. These queries automatically make calls to the correct external database by means of the External Table Query Processor. 4 Using the Caché SQL Gateway

3 Configuration The SQL Gateway is automatically installed as part of Caché. The SQL Gateway connects to a specific external database via a defined connection. To define such a connection, the tasks are: 1. Define an ODBC data source for the external database (refer to the external database's documentation for more information on how to do this). 2. Define a logical connection to this data source. 3.1 Creating an SQL Gateway Connection Caché maintains a list of SQL Gateway connection definitions. Each connection definition consists of a logical name (used within the application to refer to this connection); an ODBC data source name (DSN); and a user name and password to use when establishing the connection. Every external table within Caché is associated with a particular logical connection name. Caché automatically establishes a connection with an external database the first time a process refers to its logical connection. To define a new SQL Gateway connection (or edit an existing one), perform the following steps: 1. In the System Management Portal, go to the SQL Gateway Connections page ([Home] > [Configuration] > [SQL Gateway Connections]). (Specifically, from the Portal Home page, select Configuration from the System Administration column; from the Configuration page that appears, select SQL Gateway Connections from the Connectivity column.) 2. On the SQL Gateway Connections page, click Create New Connection. This displays the SQL Gateway Connection page ([Home] > [Configuration] > [SQL Gateway Connections] > [SQL Gateway Connection]). Using the Caché SQL Gateway 5

Configuration 3. On the SQL Gateway Connection page, enter or choose values for the following fields: Connection Name An identifier for the connection being configured. Select an existing DSN The Data Source Name to accept connections User The name for the account to serve as the default for establishing connections Password The password associated with the default account Enable legacy outer join syntax (Sybase) Whether or not the connection supports this syntax 4. You can test that the values allow for establishing a connection by clicking the Test Connection button. 5. To create the named connection, click Save. 6 Using the Caché SQL Gateway

4 Using the SQL Gateway Using the SQL Gateway within an application is straightforward. The simplest way to use it is to start from a table already defined in a third-party RDBMS; in this case, simply define a connection to this database and use the Caché Link Table Wizard available on the SQL page of the System Management Portal ([Home] > [SQL]) to automatically generate a Caché persistent class that uses the external table for its data storage. 4.1 Using the Link Table Wizard The Link Table Wizard reads a table definition from an external database and generates a new persistent Caché class. The new class stores and retrieves its data from the external table using the SQL Gateway. After you have defined an external database connection (see Configuration, you can use the Link Table Wizard as follows: 1. From the SQL page of the System Management Portal ([Home] > [SQL]), click Link Table Wizard. This displays the Link Table Wizard. 2. The first page of the wizard allows you to select the table to be made available through the Gateway connection. The fields on this page allow you to specify the available table: Select a SQL Gateway connection The SQL Gateway connection that is to serve as the source for the data. To create an SQL Gateway connection, see the section Creating an SQL Gateway Connection. Table Type Which kinds of tables are to be made available. Schema The schema (package) from which tables are to be made available. Tables The table itself to be made available. Using the Caché SQL Gateway 7

Using the SQL Gateway 3. The second page of the wizard lists available and selected fields (properties). Highlight one or more fields and click the single arrow to move it or them from one list to another; click the double arrow to move all fields (selected or not) from one list to another. In the selected list, the up and down arrows allow you to modify the order of the list. 4. The third page of the wizard allows you to specify the behavior and appearance of the displayed information. The available options are: Read only Makes the displayed field non-writeable. (The select_all check box makes all the fields non-writeable.) New Caption New Column Name 5. On the last page of the wizard, check that the primary key field(s), as well as the SQL table and Class name to be used for the new class is correct. 6. Clicking Finish on the last page of the wizard displays a page that allows you to establish a test connection to the data source for the Gateway. At this point, the Link Table Wizard stores a new class definition within the Caché database and compiles it. If data is present, it should be immediately visible in the external database (you can check by issuing SQL queries against the newly created Caché class/table). You can now use the new class as you would any other persistent class within Caché. 4.2 Debugging Any Gateway Problems If you encounter any problems, you can monitor the Gateway as follows: 1. Set the value of the ^%ISCLOG global to 3 by typing the following at the Caché terminal prompt: Set ^%ISCLOG = 3 The ^%ISCLOG global logs events in Caché for use in debugging. 2. Turn on logging for the DSN in use, if the DSN supports this. A DSN with logging functionality will has a check box or other switch on its screen. For instance, the Caché DSN has an ODBC Log check box. To display the configuration screen for a DSN, select the DSN from the one of the lists (user, system, or file) on the ODBC Data Source Administrator screen, which you can display by selecting Data Sources (ODBC) from the Administrative Tools screen, which is available from the Windows Control Panel. 8 Using the Caché SQL Gateway

3. Turn on logging for the ODBC driver manager by selecting the Start Tracing Now button on the Tracing tab of the ODBC Data Source Administrator screen. Again, to display this screen, select Data Sources (ODBC) from the Administrative Tools screen, which is available from the Windows Control Panel. 4. Run your application, ensuring that you trigger the error condition. Debugging Any Gateway Problems 5. Check all the logs for error messages or any other unusual activity. The cause of the error is often obvious. Using the Caché SQL Gateway 9

5 Restrictions The current version of the Caché SQL Gateway has the following limitations and restrictions: All the tables listed in the FROM clause of an SQL query must come from the same data source. Queries joining data from heterogeneous data sources are not allowed. SQL queries targeted at external databases cannot use Caché SQL extensions. This includes the -> operator, including other columns within a count (*) query, and the various Caché-specific operators whose name starts with %. The external RDBMS must have an ODBC interface. This interface must correctly support the functionality required by the SQL Gateway. Using the Caché SQL Gateway 11