Watch 15 Star 9 Fork 5

openLooKeng / hetu-odbc-driverCLGPL-2.1

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
The ODBC driver of openLooKeng provides the ODBC interconnection capability for openLooKeng. spread retract

  • C 95.8%
  • CMake 2.7%
  • Shell 0.5%
  • C++ 0.4%
  • Batchfile 0.3%
  • Other 0.3%
Clone or download 7.06 KB
Copy Edit Web IDE Raw Blame History

ODBC Protocol Implementation

Protocol Implementation

  1. Supports 16 types of openLooKeng data type (test case: test/datatypes.c).
  2. Complies with the ODBC 3.5 protocol and supports core-level APIs and some L1 and L2 APIs. (Test case: test/conformancelevel.c)
  3. Supports the scalar function of the ODBC and SQL 92 style (test case: test/sqlgrammar.c).
  4. Catalog functions (test case: test/catalog1.c)
  5. Prepared execution and Direct Execution (test case: test/datahandle.c)
  6. Test on PowerBI Desktop and Tableau Desktop

Note: For details about the protocol implementation, see the end-to-end test cases in the test directory.


  1. Only the 64-bit Windows operating system is released. Currently, the following operating systems have been verified: Windows 10 and Windows Server 2016.
  2. The metadata API may be slow because the Presto Server queries the information schema slowly.

Note: Other Windows systems may also run properly, but we have not verified the system. You are welcome to provide the test results and problems of other systems. If you have any feedback, submit the issue.

Basic principles

Solution Introduction

The openLooKeng ODBC Driver solution reuses existing components to the maximum extent and uses the bridging solution (the front end uses the ODBC protocol and the back end uses the JDBC protocol for interconnection). The open-source software MariaDB ODBC driver and MyCat Server are selected, the openLooKeng ODBC Driver is implemented based on the two software.


Major modifications at the front end:

  1. Data type adaptation
  2. Catalog function adaptation
  3. Consistency level and setting adaptation
  4. DNS parameter adaptation and simplification
  5. Connection and authentication parameters can be configured for different JDBC drivers.
  6. Integrate the gateway component.
  7. Installation program and DSN configuration interface OEM

Major changes at the backend:

  1. Backend data source connection and authentication passthrough
  2. Presto data type adaptation and conversion
  3. MySQL C/S Command Input and Output Parameter Data Types
  4. Scalar function support in ODBC and SQL 92 styles
  5. JVM memory optimization
  6. E2E transaction support
  7. OpenJDK integration

Compatibility with the Presto Ecosystem

OpenLooKeng leverages the well-known open-source SQL engine - Presto, and add a lot of enhancements over Presto. Therefore, the openLooKeng ODBC driver is also considered for the Presto ecosystem. We are compatible with the Presto ecosystem based on the following points:

  1. Presto data type, SQL syntax
  2. Presto data dictionary (system table)
  3. Standard JDBC protocol
  4. Replaceable JDBC Driver interconnected with the server

The connection and authentication functions with the server are offloaded to the JDBC driver layer. In the branch version of the Presto ecosystem, a large number of customized implementation solutions are provided to implement the functions. Each version uses its own JDBC driver to implement the interconnection of these functions. In terms of JDBC configuration parameters, we have streamlined the configuration parameters between the version and the DSN, the DSN allows you to flexibly configure JDBC parameters. For details, see JDBC Driver Adaptation.


Setting Up the Environment

1. Prepare

The following software has been installed:

2. Build

  git clone


 git clone       
Go to the code directory and configure and compile the code.   
 cmake --build . --config RelWithDebInfo
Note: 1. During the build, two pieces of code that depend on the code repository are downloaded. Ensure that the download channel is available. For details about the two pieces of code, see the .gitmodules file. 
      2. For the -G parameter, if you use Visual Studio 2017, set to "Visual Studio 15 2017".For more options, see the CMake manual.


Program Starting and Stopping




<Installation directory>\odbc_gateway\mycat\mycat.bat {start | stop | restart | status} 

Program Log

Trace Log Function of Microsoft ODBC Driver Manager

For details, see or

ODBC driver

On the DSN configuration page, select DEBUG. The Driver records debug logs in the %TMP%\MAODBC.LOG file.

ODBC gateway

< Installation directory >\odbc_gateway\mycat\logs\mycat.log
Historical logs are archived to subdirectories.

Program Test

Microsoft ODBC Test

The ODBC API test tool developed by Microsoft can test the ODBC API without writing a line of code. This tool is a part of the MDAC tool package. You can download the tool from

The simba blog provides a more detailed description of how to use it.

Running Test Cases

The test directory contains a large number of test cases. You can write your own test cases to test or debug code.

JDBC Driver Adaptation

This function is compatible with PrestoSQL, PrestoDB and other presto forks with special connection and authentication implementation. It is connected to and authenticated by the server and has been uninstalled to the JDBC driver layer. You can perform secondary adaptation to the JDBC driver implementation layer to support the ODBC of the server.

1. Remove the driver of openLooKeng and change it to your JDBC driver.


Node: The version may be upgraded, here just an example.

2. Change the protocol prefix of the JDBC driver.


  <! -- 
    the jdbc url prefix, openLooKeng-> jdbc:lk://, presto-> jdbc:presto:// 
  <property name="jdbcUrlPrefix">jdbc:lk://</property> 

3. JVM customized parameters in the JDBC running environment


Add new configuration parameters to the file.

Note: Before modifying the configuration items in the mycat directory, stop the mycat service.

4. Configuring the URL Parameters and Attribute File for the Connection

Set the customized connection parameters in Connect URL and Connect Config on the DSN configuration page.

Comment ( 0 )

Sign in for post a comment