Connectors and APIs
Database Connectors provide connectivity to the TiDB server for client programs. APIs provide low-level access to the MySQL protocol and MySQL resources. Both Connectors and the APIs enable you to connect and execute MySQL statements from another language or environment, including ODBC, Java (JDBC), Perl, Python, PHP, Ruby and C.
TiDB is compatible with all Connectors and APIs of MySQL (5.6, 5.7), including:
- MySQL Connector/C++
- MySQL Connector/J
- MySQL Connector/Net
- MySQL Connector/ODBC
- MySQL Connector/Python
- MySQL C API
- MySQL PHP API
- MySQL Perl API
- MySQL Python API
- MySQL Ruby APIs
- MySQL Tcl API
- MySQL Eiffel Wrapper
- Mysql Go API
Connect to TiDB using MySQL Connectors
Oracle develops the following APIs and TiDB is compatible with all of them:
- MySQL Connector/C++:to enable C++ applications to connect to MySQL
- MySQL Connector/J:to enable Java applications to connect to MySQL using the standard JDBC API
- MySQL Connector/Net:to enable .Net applications to connect to MySQL; MySQL for Visual Studio uses this; support Microsoft Visual Studio 2012, 2013, 2015 and 2017 versions
- MySQL Connector/ODBC:the standard ODBC API; support Windows, Unix, and OS X platforms
- MySQL Connector/Python:to enable Python applications to connect to MySQL, compliant with the Python DB API version 2.0
Connect to TiDB using MySQL C API
If you use C language programs to connect to TiDB, you can connect to libmysqlclient
directly and use the MySQL C API. This is one of the major connection methods using C language, widely used by various clients and APIs, including Connector/C.
Connect to TiDB using third-party MySQL APIs
The third-party APIs are not developed by Oracle. The following table lists the commonly used third-party APIs:
Environment | API | Type | Notes |
---|---|---|---|
Ada | GNU Ada MySQL Bindings | libmysqlclient | See MySQL Bindings for GNU Ada |
C | C API | libmysqlclient | See MySQL C API |
C++ | Connector/C++ | libmysqlclient | See MySQL Connector/C++ Developer Guide |
MySQL++ | libmysqlclient | See MySQL++ Web site | |
MySQL wrapped | libmysqlclient | See MySQL wrapped | |
Go | go-sql-driver | Native Driver | See Mysql Go API |
Cocoa | MySQL-Cocoa | libmysqlclient | Compatible with the Objective-C Cocoa environment. See http://mysql-cocoa.sourceforge.net/ |
D | MySQL for D | libmysqlclient | See MySQL for D |
Eiffel | Eiffel MySQL | libmysqlclient | See Section 27.14, “MySQL Eiffel Wrapper” |
Erlang | erlang-mysql-driver | libmysqlclient | See erlang-mysql-driver |
Haskell | Haskell MySQL Bindings | Native Driver | See Brian O'Sullivan's pure Haskell MySQL bindings |
hsql-mysql | libmysqlclient | See MySQL driver for Haskell | |
Java/JDBC | Connector/J | Native Driver | See MySQL Connector/J 5.1 Developer Guide |
Lua | LuaSQL | libmysqlclient | See LuaSQL |
.NET/Mono | Connector/Net | Native Driver | See MySQL Connector/Net Developer Guide |
Objective Caml | OBjective Caml MySQL Bindings | libmysqlclient | See MySQL Bindings for Objective Caml |
Octave | Database bindings for GNU Octave | libmysqlclient | See Database bindings for GNU Octave |
ODBC | Connector/ODBC | libmysqlclient | See MySQL Connector/ODBC Developer Guide |
Perl | DBI /DBD::mysql | libmysqlclient | See Section 27.10, “MySQL Perl API” |
Net::MySQL | Native Driver | See Net::MySQL at CPAN | |
PHP | mysql , ext/mysql interface (deprecated) | libmysqlclient | See Original MySQL API |
mysqli , ext/mysqli interface | libmysqlclient | See MySQL Improved Extension | |
PDO_MYSQL | libmysqlclient | See MySQL Functions (PDO_MYSQL) | |
PDO mysqlnd | Native Driver | ||
Python | Connector/Python | Native Driver | See MySQL Connector/Python Developer Guide |
Python | Connector/Python C Extension | libmysqlclient | See MySQL Connector/Python Developer Guide |
MySQLdb | libmysqlclient | See Section 27.11, “MySQL Python API” | |
Ruby | MySQL/Ruby | libmysqlclient | Uses libmysqlclient . See Section 27.12.1, “The MySQL/Ruby API” |
Ruby/MySQL | Native Driver | See Section 27.12.2, “The Ruby/MySQL API” | |
Scheme | Myscsh | libmysqlclient | See Myscsh |
SPL | sql_mysql | libmysqlclient | See sql_mysql for SPL |
Tcl | MySQLtcl | libmysqlclient | See Section 27.13, “MySQL Tcl API” |
Connector versions supported by TiDB
Connector | Connector Version |
---|---|
Connector/C | 6.1.0 GA |
Connector/C++ | 1.0.5 GA |
Connector/J | 5.1.8 |
Connector/Net | 6.9.9 GA |
Connector/Net | 6.8.8 GA |
Connector/ODBC | 5.1 |
Connector/ODBC | 3.51 (Unicode not supported) |
Connector/Python | 2.0 |
Connector/Python | 1.2 |