Connecting to a Teiid Spring Boot Server

The Teiid Spring Boot JDBC API provides Java Database Connectivity (JDBC) access to a Virtual Database (VDB) deployed on Teiid Spring Boot. The Teiid Spring Boot JDBC API is compatible with the JDBC 4.0 specification; however, it is not compatible with some methods. You cannot use some advanced features, such as updatable result sets or SQL3 data types.

Java client applications connecting to a Teiid Spring Boot Server will need to use at least the Java 1.8 JDK. Earlier versions of Java are not compatible. You may attempt to use a client driver from earlier Teiid versions that were compatible with the target JRE.

After you deploy the virtual database, client applications can connect to it and issue SQL queries against it using the JDBC API. If you are new to JDBC, refer to the Java documentation about JDBC. Teiid Spring Boot ships with teiid-VERSION_NUMBER-jdbc.jar that is available from the Teiid.io downloads.

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

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

where versionNumber is the version of the most recent Teiid Spring Boot release.

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 Spring Boot Server, you can use standard JDBC API classes to interrogate metadata and execute queries.

OpenTracing compatibility

OpenTracing 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 is defined in the project integration bom.

Alternately, you can manually include the opentracing-util, opentracing-api, and opentracing-noop jar files as needed by the tooling or other environment where the Teiid Spring Boot 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 ""