mysql rsa连接_mysql-c++连接

1、

mysql-c++连接

MySQL :: Download Connector/C++ https://dev.mysql.com/downloads/connector/cpp/

1-1

VS2015中添加依赖库文件的三种方式 - heibao111728的博客 - CSDN博客

https://blog.csdn.net/heibao111728/article/details/81943953

展开项目——》右击references——》add references——》选择依赖的库文件项目即可。

先从官网下载安装,在查找库文件路径

// mysqlCon.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。

#include "pch.h"

#include

#include

#include

/* uncomment for applications that use vectors */

/* include */

#include "jdbc/mysql_connection.h"

#include "jdbc/cppconn/driver.h"

#include "jdbc/cppconn/exception.h"

#include "jdbc/cppconn/resultset.h"

#include "jdbc/cppconn/statement.h"

#include "jdbc/cppconn/prepared_statement.h"

#define EXAMPLE_HOST "l"

#define EXAMPLE_USER "l"

#define EXAMPLE_PASS "l"

#define EXAMPLE_DB "l"

using namespace std;

/*

MySQL :: MySQL Connector/C++ 8.0 Developer Guide :: 3 Installing Connector/C++ from a Binary Distribution

https://dev.mysql.com/doc/connector-cpp/8.0/en/connector-cpp-installation-binary.html

MySQL :: MySQL Connector/C++ 1.1 Developer Guide :: 7 Connector/C++ Tutorials

https://dev.mysql.com/doc/connector-cpp/1.1/en/connector-cpp-tutorials.html

MySQL :: MySQL Connector/C++ 1.1 Developer Guide :: 7.1 Prerequisites and Background Information

https://dev.mysql.com/doc/connector-cpp/1.1/en/connector-cpp-tutorials-background.html

Boost Downloads https://www.boost.org/users/download/

Boost 1.70.0 Library Documentation https://www.boost.org/doc/libs/1_70_0/

*/

int main(int argc,const char **argv)

{

std::cout << "Hello World!\n";

string url(argc >=2 ? argv[1]:EXAMPLE_HOST);

const string user(argc >=3 ? argv[2]:EXAMPLE_USER);

const string pass(argc >=4 ? argv[3]:EXAMPLE_PASS);

const string database(argc >=5 ? argv[4]:EXAMPLE_DB);

cout << "Connector /C++ turtorial framework..." << endl;

cout << endl;

try {

/* INSERT TUTORIAL CODE HERE! */

}

catch (sql::SQLException &e) {

/*

MySQL Connector/C++ throws three different exceptions:

- sql::MethodNotImplementedException (derived from sql::SQLException)

- sql::InvalidArgumentException (derived from sql::SQLException)

- sql::SQLException (derived from std::runtime_error)

*/

cout << "ERR: SQLException in " << __FILE__;

cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << endl;

/* what() (derived from std::runtime_error) fetches error message */

cout << "# ERR: " << e.what();

//cout << " (MySql error code: " << e.getErrorCode();

//cout << ", SQLState: " << e.getSQLState() << " )" << endl;

return EXIT_FAILURE;

}

cout << "Done." << endl;

return EXIT_SUCCESS;

}

// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单

// 调试程序: F5 或调试 >“开始调试”菜单

// 入门提示:

// 1. 使用解决方案资源管理器窗口添加/管理文件

// 2. 使用团队资源管理器窗口连接到源代码管理

// 3. 使用输出窗口查看生成输出和其他消息

// 4. 使用错误列表窗口查看错误

// 5. 转到“项目”>“添加新项”以创建新的代码文件,或转到“项目”>“添加现有项”以将现有代码文件添加到项目

// 6. 将来,若要再次打开此项目,请转到“文件”>“打开”>“项目”并选择 .sln 文件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值