Connecting to a Teiid Server

The Teiid JDBC API provides Java Database Connectivity (JDBC) access to a Virtual Database (VDB) deployed on Teiid. The Teiid JDBC API is compatible with the JDBC 4.0 specification; however, it does not fully support all methods. Advanced features, such as updatable result sets or SQL3 data types, are not supported.

Java client applications connecting to a Teiid Server will need to use at least the Java 1.8 JDK. Previous versions of Java are not supported. You may attempt to use a client driver from a previous Teiid version that supported the target JRE.

Support for Teiid clients and servers older than version 8 has been dropped from Teiid 10.2 and later.

Before you can connect to the Teiid Server using the Teiid JDBC API, please do following tasks first.

  1. Install the Teiid Server. See the "Admin Guide" for instructions.

  2. Build a Virtual Database (VDB). Check the "Reference Guide" for instructions on how to build a VDB. If you do not know what VDB is, then start with this document.

  3. Deploy the VDB into Teiid Server. Check Administrator’s Guide for instructions.

  4. Start the Teiid Server (WildFly), if it is not already running.

Once you have the VDB deployed in Teiid, client applications can connect to the Teiid Server and issue SQL queries against deployed VDB using JDBC API. If you are new to JDBC, see Java’s documentation about JDBC. Teiid ships with teiid-13.0.0-jdbc.jar that can be found in the downloads.

You can also obtain the Teiid JDBC from the Maven Repository https://oss.sonatype.org/content/repositories/releases/ using the coordinates:

<dependency>
  <groupId>org.teiid</groupId>
  <artifactId>teiid</artifactId>
  <classifier>jdbc</classifier>
  <version>13.0.0</version>
</dependency>

Important classes in the client JAR:

  • org.teiid.jdbc.TeiidDriver- allows JDBC connections using the DriverManager class.

  • org.teiid.jdbc.TeiidDatasource- allows JDBC connections using the DataSource XADataSource class. You should use this class to create managed or XA connections.

Once you have established a connection with the Teiid Server, you can use standard JDBC API classes to interrogate metadata and execute queries.

OpenTracing Support

OpenTracing support is optional for the client driver. For remote connections to propagate the span the driver must have the appropriate OpenTracing jars in its classpath. This can be done via a maven dependency:

<dependency>
    <groupId>io.opentracing</groupId>
    <artifactId>opentracing-util</artifactId>
    <version>${version.opentracing}</version>
</dependency>

where version.opentracing (0.31 for Teiid 11.0) is defined in the project integration bom.

Or you may manually include the opentracing-util, opentracing-api, and opentracing-noop jars as needed by the tooling or other environment where the Teiid client jar is utilized.

OpenTracing support in the client and server requires that the respective runtimes have an appropriate tracing client installed and available via the GlobalTracer.

results matching ""

    No results matching ""