Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Driver Name: org.apache.flink.table.jdbc.FlinkDriver
  2. Flink Connection URL: Users can use default catalog and database directly, or set them in url. Users can also set custom parameters in url to open the session in SqlGateway with key1=val1&key2=val2&... 
    1. jdbc:flink://{sql-gateway.host}:{sql-gateway.port}?key1=val1&key2=val2
    2. jdbc:flink://{sql-gateway.host}:{sql-gateway.port}/{catalog name}?key1=val1&key2=val2
    3. jdbc:flink://{sql-gateway.host}:{sql-gateway.port}/{catalog name}/{database name}?key1=val1&key2=val2
  3. Currently SqlGateway does not support authentication, user  and password in connection are invalid.
  4. Use Flink Jdbc Driver in Java code

    Code Block
    languagejava
    String driverName = "org.apache.flink.table.jdbc.FlinkDriver";
    String url = "jdbc:flink://{sql-gateway.host}:{sql-gateway.port}/{catalog name}/{database name}?key1=val1&key2=val2";
    Class.forName(driverName);
    
    try (Connection connection = DriverManager.getConnection(url)) {
        try (Statement statement = connection.createStatement()) {
            try (ResultSet resultSet = statement.execute("SELECT * FROM {Your Table}")) {
                while (resultSet.hasNext()) {
                    ....
                }
            }
        }
    }


  5. User can also add the flink-table-jdbc-driver-{version}.jar to the classpath of external jdbc tools.

Data Types

We support to convert the The following basic flink data type types are supported to convert to sql data type in this FLIP, and more types can be supported as needed in the future.

...