title | aliases | ||
---|---|---|---|
连接器和 API |
|
数据库连接器为客户端提供了连接数据库服务端的方式,APIs 提供了使用 MySQL 协议和资源的底层接口。无论是连接器还是 API,都可以用来在不同的语言和环境内连接服务器并执行 sql 语句,包括 odbc、java(jdbc)、Perl、Python、PHP、Ruby 和 C。
TiDB 兼容 MySQL(5.6, 5.7) 的所有连接器和 API,包括:
- 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
Oracle 官方提供了以下 API,TiDB 可以兼容所有这些 API。
- MySQL Connector/C++:C++ 语言的客户端库
- MySQL Connector/J:Java 语言的客户端库,基于标准 JDBC 接口
- MySQL Connector/Net:.Net 语言的客户端库,MySQL for Visual Studio使用这个库,支持 Microsoft Visual Studio 2012,2013,2015和2017版本
- MySQL Connector/ODBC:标准的 ODBC 接口,支持 Windows,Unix 和 OS X
- MySQL Connector/Python:Python 语言的客户端包,和 Python DB API version 2.0 一致
如果使用 C 语言程序直接连接 TiDB,可以直接链接 libmysqlclient 库,使用 MySQL 的 C API,这是最主要的一种 C 语言连接方式,被各种客户端和 API 广泛使用,包括 Connector/C。
第三方 API 非 Oracle 官方提供,下表列出了常用的第三方 API:
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 | 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 |