Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/main/sphinx/connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Snowflake <connector/snowflake>
SQL Server <connector/sqlserver>
System <connector/system>
Thrift <connector/thrift>
Tibero <connector/tibero>
TPC-DS <connector/tpcds>
TPC-H <connector/tpch>
```
Expand Down
215 changes: 215 additions & 0 deletions docs/src/main/sphinx/connector/tibero.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
# Tibero connector

The Tibero connector allows querying and creating tables in an external
[Tibero](https://www.tmaxtibero.com/product/productView.do?prod_cd=tibero&detail_gubun=prod_main) database.
Tibero is an enterprise-grade relational database management system developed
by TmaxSoft.

## Requirements

To connect to Tibero, you need:

- Tibero 6 or higher.
- Tibero JDBC driver (`tibero7-jdbc.jar`) manually copied into the Trino plugin
directory. The driver is not bundled with Trino because it is not available
in public Maven repositories.

## JDBC driver installation

The Tibero JDBC driver must be obtained from TmaxSoft and placed in the Trino
plugin directory manually.

### Obtaining the driver

- **If you have Tibero database installed**: The JDBC driver is included in the
Tibero installation at `$TB_HOME/client/lib/jar/`. See the
[Tibero JDBC documentation](https://docs.tibero.com/tibero/en/topics/development/jdbc-developers-guide/introduction-to-tibero-jdbc#default-path)
for more details.

- **If you don't have Tibero installed**: Download the Tibero distribution from
[TechNet](https://technet.tibero.com/en/front/download/findDownloadList.do).
After extracting the archive, the JDBC driver is located at
`$TB_HOME/client/lib/jar/`.

Contact TmaxSoft for licensing information and to ensure the driver can be used
in your environment.

### Installing the driver

Copy the JDBC driver JAR file into the Tibero connector plugin directory:

```bash
cp /path/to/tibero7-jdbc.jar <trino-installation>/plugin/tibero/
```

### Docker deployment

When using the official `trinodb/trino` Docker image, the Tibero connector
plugin is included but the JDBC driver must be added separately. Create a
custom Docker image as follows:

```dockerfile
FROM trinodb/trino:{doc_version}

# Copy the Tibero JDBC driver obtained from TmaxSoft
COPY tibero7-jdbc.jar /usr/lib/trino/plugin/tibero/

# Add the Tibero catalog configuration
COPY tibero.properties /etc/trino/catalog/tibero.properties
```

Build and run the image:

```bash
docker build -t trino-tibero .
docker run -p 8080:8080 trino-tibero
```

> **Note:**
Ensure you have the appropriate license from TmaxSoft to use the Tibero JDBC
driver in your environment. The driver's usage is subject to TmaxSoft's
licensing terms.

## Configuration

To configure the Tibero connector as the `example` catalog, create a file
named `example.properties` in `etc/catalog`. Include the following
connection properties in the file:

```text
connector.name=tibero
connection-url=jdbc:tibero:thin:@example.net:8629:tibero
connection-user=tibero
connection-password=secret
```

The `connection-url` defines the connection information and parameters to pass
to the JDBC driver. The Tibero connector uses the Tibero JDBC Thin driver.
The format is:

```
jdbc:tibero:thin:@<host>:<port>:<sid>
```

The `connection-user` and `connection-password` are typically required and
determine the user credentials for the connection, often a service user. You can
use {doc}`secrets </security/secrets>` to avoid actual values in the catalog
properties files.


## Querying Tibero

The Tibero connector provides a schema for every Tibero database.

Run `SHOW SCHEMAS` to see the available Tibero databases:

```
SHOW SCHEMAS FROM example;
```

If you used a different name for your catalog properties file, use that catalog
name instead of `example`.

> **Note:**
The Tibero user must have access to the table in order to access it from Trino.
The user configuration, in the connection properties file, determines your
privileges in these schemas.


### Examples

If you have a Tibero database named `web`, run `SHOW TABLES` to see the
tables it contains:

```
SHOW TABLES FROM example.web;
```

To see a list of the columns in the `clicks` table in the `web`
database, run either of the following:

```
DESCRIBE example.web.clicks;
SHOW COLUMNS FROM example.web.clicks;
```

To access the clicks table in the web database, run the following:

```
SELECT * FROM example.web.clicks;
```


## Type mapping

Because Trino and Tibero each support types that the other does not, this
connector {ref}`modifies some types <type-mapping-overview>` when reading or
writing data. Data types may not map the same way in both directions between
Trino and the data source. Refer to the following sections for type mapping in
each direction.

### Tibero to Trino type mapping

Trino supports reading the following Tibero database types:

| Tibero type | Trino type | Notes |
|-------------|------------|-------|
| `SMALLINT` | `SMALLINT` | |
| `INTEGER` | `INTEGER` | |
| `BIGINT` | `BIGINT` | |
| `REAL` | `REAL` | |
| `DOUBLE` | `DOUBLE` | |
| `NUMBER(p, s)`, `DECIMAL(p, s)` | `DECIMAL(p, s)` | Default precision is 38 if not specified |
| `CHAR(n)` | `CHAR(n)` | |
| `VARCHAR(n)`, `NVARCHAR(n)` | `VARCHAR(n)` | |
| `CLOB`, `NCLOB` | `VARCHAR` | Unbounded VARCHAR |
| `RAW(n)`, `BLOB` | `VARBINARY` | |
| `DATE` | `TIMESTAMP(0)` | Tibero DATE includes time components |
| `TIMESTAMP(p)` | `TIMESTAMP(p)` | Precision up to 9 digits |

No other types are supported.

### Trino to Tibero type mapping

Trino supports creating tables with the following types in Tibero:

| Trino type | Tibero type | Notes |
|------------|-------------|-------|
| `SMALLINT` | `SMALLINT` | |
| `INTEGER` | `INTEGER` | |
| `BIGINT` | `BIGINT` | |
| `REAL` | `REAL` | |
| `DOUBLE` | `DOUBLE PRECISION` | |
| `CHAR(n)` | `CHAR(n)` | |
| `VARCHAR(n)`, `VARCHAR` | `VARCHAR(n)`, `VARCHAR` | Unbounded VARCHAR is supported |

No other types are supported.


### Mapping datetime types

Writing a timestamp with fractional second precision (`p`) greater than 9
rounds the fractional seconds to nine digits.

Tibero `DATE` type stores year, month, day, hour, minute, and seconds, so it
is mapped to Trino `TIMESTAMP(0)`.

```{include} jdbc-type-mapping.fragment
```


## SQL support

The connector provides read access and write access to data and metadata in
Tibero. In addition to the [globally available](sql-globally-available) and
[read operation](sql-read-operations) statements, the connector supports the
following features:

- [](/sql/insert)
- [](/sql/delete)
- [](/sql/truncate)
- [](/sql/create-table)
- [](/sql/create-table-as)
- [](/sql/drop-table)
- [](/sql/alter-table)
- [](/sql/comment)
122 changes: 122 additions & 0 deletions plugin/trino-tibero/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.trino</groupId>
<artifactId>trino-root</artifactId>
<version>481-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>trino-tibero</artifactId>
<packaging>trino-plugin</packaging>
<name>${project.artifactId}</name>
<description>Trino - Tibero connector</description>

<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<classifier>classes</classifier>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>configuration</artifactId>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-base-jdbc</artifactId>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-plugin-toolkit</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>slice</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api-incubator</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-context</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-spi</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>junit-extensions</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>testing</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-main</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-testing</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Loading