sql server可以用微软官方的odbc来访问,资料很详细。而mysql由于是免费的, 或者由于效率,所以更多公司选择用mysql。
mysql官方提供了mysql connector的c++封装库,目前最新版本是1.1.0,和原先1.0.5版本相比,添加了boost库。
为了少安装boost库,我用的1.0.5版本,下载了msi文件,安装了debug和release需要用到的Lib和头文件。如果直接下载noinstall二进制库,则只支持release。
http://www.cnblogs.com/qlee/archive/2011/04/08/2009655.html
解决error:2014 Commands out of sync; you can't run this command now
@warn: mysql connector/c++, prepare statement有错,改用statement.
结果集经常有error:2014 Commands out of sync; you can't run this command now的错误,
根据官网例子,套个循环,保证结果集清空
http://blog.youkuaiyun.com/luketty/article/details/5745000