CREATE FOREIGN DATA WRAPPER

<< Click to Display Table of Contents >>

Navigation:  Streaming SQL Reference Guide > CREATE statements >

CREATE FOREIGN DATA WRAPPER

Previous pageReturn to chapter overviewNext page

As in other SQL-based systems, foreign data wrappers handle access to external objects from s-Server. Two commonly referenced data wrappers are ECDA, a wrapper that handles connections to a variety of data sources, including the file system, Kafka topics, network sockets, Kinesis streams, and AMQP; and SYS/JDBC, which handles connections to RDBMS systems.

Syntax

create_foreign_data_wrapper05

Syntax Chart for CREATE FOREIGN DATA WRAPPER

Example of specifying a library and a language:

CREATE FOREIGN DATA WRAPPER probeWrapper

LIBRARY '/usr/lib/sqlstream/adapters/probeReader.jar'

LANGUAGE JAVA;

 

Example of option specification:

OPTIONS ( protocol'TCP/IP')

 

Notes:

1.If a data wrapper specifies a JAR file rather than a class file, then the JAR is automatically added to CLASSPATH. (It is not necessary to register it with the SQLstream engine by adding it into the file $SQLSTREAM_HOME/bin/classpath.gen.) This is the effect, for example, of using statement A below instead of statement B:
a.LIBRARY '${FARRAGO_HOME}/plugin/FarragoMedJdbc.jar'
b.LIBRARY 'class net.sf.farrago.namespace.jdbc.MedJdbcForeignDataWrapper'

2. CREATE FOREIGN DATA WRAPPER is unnecessary when defining a server for a JDBC peer using a JDBC client driver that matches the RDBMS, such as those that come with SQLstream for SQLServer, Oracle, MySQL, and SQLstream.

For these RDBMS, you can define the server for a JDBC peer using the CREATE SERVER command, specifying FOREIGN DATA WRAPPER "SYS_JDBC.

See SYS_JDBC in the SQLstream s-Server Integration Guide
See also the examples in the SQL/MED discussions in the Getting Started Guide.

For more detail on foreign data sources, see:

The topic DROP FOREIGN DATA WRAPPER in this guide.