mysql开发之API

来源:互联网 发布:vb.net中单选按钮 编辑:程序博客网 时间:2024/06/07 15:57

1 系统环境

centos7_x64

[root@localhost datas]# uname -aLinux localhost.localdomain 3.10.0-514.16.1.el7.x86_64 #1 SMP Wed Apr 12 15:04:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux[root@localhost datas]# mysqladmin --versionmysqladmin  Ver 8.42 Distrib 5.6.31, for Linux on x86_64

参考网址(https://dev.mysql.com/doc/refman/5.6/en/connectors-apis.html)

2 开发环境配置

1 安装配置connector/c++
connector/c++是一个mysql连接器,使用connector/c++可以更方便的开发c++与数据库交互的程序。
与MySQL C API(MySQL客户端库)相比,MySQL Connector / C ++为C ++用户提供了以下好处:
纯C ++的便利性,
不需要C函数调用,
支持JDBC 4.0,一个行业标准的API,
支持面向对象的编程范例,
减少开发时间,
在GPL许可下使用FLOSS许可证例外,
根据要求可以获得商业许可证。
安装先决条件:
(https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-installation-source-prerequisites.html)
You must use either a General Availability version of MySQL 5.7 (5.7.9 or higher) or Connector/C 6.1.8 or higher. Set the MYSQL_DIR CMake option appropriately at configuration time as necessary.

同时还相关解释:
(https://dev.mysql.com/doc/connectors/en/connector-cpp-usage-notes.html)
In general, Connector/C++ works with MySQL 5.0, but it is not completely supported. Some methods may not be available when connecting to MySQL 5.0. This is because the Information Schema is used to obtain the requested information. There are no plans to improve the support for 5.0 because the current GA version of MySQL Server is 5.6. Connector/C++ is primarily targeted at the MySQL Server GA version that is available on its release.

综合上面两部分说明,我的理解是connector/c++推荐配套的mysql版本为5.7.19或更高,对于低版本也可以用但是可能在使用过程中会报错。为了保险起见建议升级到mysql5.7.19及其以上(比如mysql5.7.20)。

下面首先要源码安装connector/c++,下载源码

git clone https://github.com/mysql/mysql-connector-cpp

相关安装过程如下:
(https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-installation-source-unix.html)

未完待续。。。

原创粉丝点击