Skip to main content
Previous sectionNext section

About the SQL Adapters

The SQL inbound and outbound adapters enable your productions to communicate with JDBC or ODBC-compliant databases. This chapter provides a brief introduction to these adapters.

Basic Tools

The adapters (EnsLib.SQL.InboundAdapter and EnsLib.SQL.OutboundAdapter) provide settings that you use to specify the data source to connect to and any login details needed for that data source.

The adapters also provide methods to perform common SQL activities such as the following:

  • Executing queries

  • Executing stored procedures

  • Performing inserts, updates, and deletes

  • Performing database transactions

  • Connecting to and disconnecting from a data source

Note:

The adapters are clients and perform authentication by passing calls that include the username and password; they do not use authentication from the operating system.

Helper Classes

InterSystems IRIS® provides two helper classes that are used as arguments and return values for the built-in SQL methods:

  • The EnsLib.SQL.GatewayResultSet class represents a special-purpose result set for use in InterSystems IRIS. An initialized instance of this class has a live data connection to a data source. The class provides methods to examine the contents of the result set as well as a method to return a static snapshot.

  • The EnsLib.SQL.Snapshot class represents a static object that you can create and populate in various ways. For example, you can populate it with the data of a result set, either all the rows or a subset of rows (starting at some row position); you can populate it with the contents of a file or stream; or you can create it row by row.

    The class provides methods for examining the data; more methods are available for this object than for the result set.

General Use

At a high level, to include an adapter in a production, you do the following:

  • Create a business host (specifically a business service or business operation) class that uses the adapter. You use the ADAPTER parameter of the business host class to specify the adapter to use.

  • Within that class, implement the methods you need. Your methods use the properties and methods of the associated adapter, via the Adapter property of your business host.

  • Add the business service or business operation to your production and provide values for any runtime settings.

In most cases, your custom code resides within your business host class. You do not typically need to customize the adapters directly.