PingCAP
  • Docs
  • Success Stories
  • Blog
  • About
  • Free Consultation
PingCAP
  • Docs
  • Success Stories
  • Blog
  • About
  • Free Consultation

Contact

中文
Documentation
  • About TiDB
    • TiDB Introduction
    • TiDB Architecture
  • Quick Start
    • TiDB Quick Start Guide
    • Basic SQL Statements
    • Bikeshare Example Database
  • TiDB User Guide
    • TiDB Server Administration
      • The TiDB Server
      • The TiDB Command Options
      • The TiDB Data Directory
      • The TiDB System Database
      • The TiDB System Variables
      • The Proprietary System Variables and Syntax in TiDB
      • The TiDB Server Logs
      • The TiDB Access Privilege System
      • TiDB User Account Management
      • Use Encrypted Connections
    • SQL Optimization
      • Understand the Query Execution Plan
      • Introduction to Statistics
    • Language Structure
      • Literal Values
      • Schema Object Names
      • Keywords and Reserved Words
      • User-Defined Variables
      • Expression Syntax
      • Comment Syntax
    • Globalization
      • Character Set Support
      • Character Set Configuration
      • Time Zone Support
    • Data Types
      • Numeric Types
      • Date and Time Types
      • String Types
      • JSON Types
      • The ENUM data type
      • The SET Type
      • Data Type Default Values
    • Functions and Operators
      • Function and Operator Reference
      • Type Conversion in Expression Evaluation
      • Operators
      • Control Flow Functions
      • String Functions
      • Numeric Functions and Operators
      • Date and Time Functions
      • Bit Functions and Operators
      • Cast Functions and Operators
      • Encryption and Compression Functions
      • Information Functions
      • JSON Functions
      • Aggregate (GROUP BY) Functions
      • Miscellaneous Functions
      • Precision Math
    • SQL Statement Syntax
      • Data Definition Statements
      • Data Manipulation Statements
      • Transactions
      • Database Administration Statements
      • Prepared SQL Statement Syntax
      • Utility Statements
      • TiDB SQL Syntax Diagram
    • JSON Functions and Generated Column
    • Connectors and APIs
    • TiDB Transaction Isolation Levels
    • Error Codes and Troubleshooting
    • Compatibility with MySQL
    • TiDB Memory Control
    • Slow Query Log
    • Advanced Usage
      • Read Data From History Versions
      • Garbage Collection (GC)
  • TiDB Operations Guide
    • Hardware and Software Requirements
    • Deploy
      • Ansible Deployment (Recommended)
      • Offline Deployment Using Ansible
      • Docker Deployment
      • Docker Compose Deployment
      • Cross-Region Deployment
      • Kubernetes Deployment
    • Configure
      • Configuration Flags
      • Configuration File Description
      • Modify Component Configuration Using Ansible
      • Enable TLS Authentication
      • Generate Self-signed Certificates
    • Monitor
      • Overview of the Monitoring Framework
      • Key Metrics
      • Monitor a TiDB Cluster
    • Scale
      • Scale a TiDB Cluster
      • Scale Using Ansible
    • Upgrade
      • Upgrade the Component Version
      • TiDB 2.0 Upgrade Guide
    • Tune Performance
    • Backup and Migrate
      • Backup and Restore
      • Migrate
        • Migration Overview
        • Migrate All the Data
        • Migrate the Data Incrementally
    • TiDB-Ansible Common Operations
    • Troubleshoot
  • TiDB Enterprise Tools
    • Syncer
    • mydumper
    • Loader
    • TiDB-Binlog
    • PD Control
    • PD Recover
    • TiKV Control
    • TiDB Controller
  • TiKV Documentation
  • TiSpark Documentation
    • Quick Start Guide
    • User Guide
  • Frequently Asked Questions (FAQ)
  • TiDB Best Practices
  • Releases
    • 2.1 RC3
    • 2.1 RC2
    • 2.0.7
    • 2.1 RC1
    • 2.0.6
    • 2.0.5
    • 2.1 Beta
    • 2.0.4
    • 2.0.3
    • 2.0.2
    • 2.0.1
    • 2.0
    • 2.0 RC5
    • 2.0 RC4
    • 2.0 RC3
    • 2.0 RC1
    • 1.1 Beta
    • 1.0.8
    • 1.0.7
    • 1.1 Alpha
    • 1.0.6
    • 1.0.5
    • 1.0.4
    • 1.0.3
    • 1.0.2
    • 1.0.1
    • 1.0
    • Pre-GA
    • RC4
    • RC3
    • RC2
    • RC1
  • TiDB Adopters
  • TiDB Roadmap
  • Connect with us
  • More Resources
    • Frequently Used Tools
    • PingCAP Blog
    • Weekly Update

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/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: a standalone replacement for the libmysqlclient, to be used for C applications
  • 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 Section 27.8, “MySQL C API”
C Connector/C Replacement for libmysqlclient See MySQL Connector/C Developer Guide
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
Kaya MyDB libmysqlclient See MyDB
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/mysqlinterface (deprecated) libmysqlclient See Original MySQL API
mysqli, ext/mysqliinterface 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
"Connectors and APIs" was last updated Jul 26 2018: *: add summary metadata to all docs files for SEO (#550) (c1e613d)
Improve this page

What’s on this page

Product

  • TiDB
  • TiSpark
  • Roadmap
  • TiDB Cloud

Docs

  • Quick Start
  • Best Practices
  • FAQ
  • TiDB Utilities
  • Release Notes

Resources

  • Blog
  • Weekly
  • GitHub
  • TiDB Academy
  • TiDB Community

Company

  • About
  • Careers
  • News
  • Contact Us
  • Privacy Policy
  • Terms of Service

Connect

  • Twitter
  • LinkedIn
  • Reddit
  • Google Group
  • Stack Overflow

© 2018 PingCAP. All Rights Reserved.

中文