通过C ++访问MySQL [英] Accessing MySQL through C++

查看:87
本文介绍了通过C ++访问MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过C ++程序在MySQL服务器上运行查询,该程序将免费向公众发布,但不在GPL或任何其他开放源代码许可下.

I want to run queries on my MySQL server through a C++ program that will be released to the public for free, but not under the GPL or any other open-source license.

我的第一个问题是我是否可以在应用程序中使用MySQL Connector/C ++库.

My first question is if I can use the MySQL Connector/C++ library in my application.

如果没有,那么我可以使用哪些替代方法?

If not, then what alternatives are there for me to use?

推荐答案

不幸的是, MySQL 已将客户端库许可证从LGPL到GPL,这意味着与这些库静态或动态链接的任何应用程序都将成为派生作品.因此,除非您购买了许可证,否则您不能在非FOSS应用程序中使用MySQL客户端库(用于访问MySQL服务器). FOSS在这里代表Free&开源.可以找到 Oracle (MySQL的所有者)认可的FOSS许可证列表. "http://www.mysql.com/about/legal/licensing/foss-exception/" rel ="noreferrer">此处.

Unfortunately, MySQL has changed client libraries licenses from LGPL to GPL which means that any application linking with those libraries statically or dynamically becomes a derivative work. Therefore, you cannot use MySQL client libraries (that are used to access MySQL server) in non-FOSS applications unless you purchase a license for that. A FOSS here stands for Free & Open Source. A list of FOSS licenses recognized by Oracle, the owner of MySQL, can be found here.

但是,您可以使用 ODBC 来访问MySQL,而无需分发任何MySQL库等,因此客户端对此负有责任,并且必须决定是否使用开放源代码或商业MySQL许可,这不使您有义务购买任何许可或根据Oracle认可的FOSS许可来分发软件.阅读本文以获取更多详细信息.

However, you can use ODBC to access MySQL without distributing any MySQL libraries etcetera, so client is responsible for that and have to decide whether to use Open Source or commercial MySQL license, which does not obligate you to purchase any licenses or distribute your software under FOSS license recognized by Oracle. Read this article for more details.

关于GPL的另一个有趣的部分是,它声明链接到GPL库的应用程序是派生的作品.这意味着,如果您要制作一个简约的开源应用程序,该应用程序链接到MySQL客户端库并与MySQL服务器通信,定义一个API接口并动态加载您的商业/封闭源代码库,该库将仅导出定义的API实现,则您不会违反许可条款和条件,因为在这种情况下,开放源代码应用程序将是封闭源代码产品的用户.商业图形驱动程序(如NVidia)和音频编解码器(如MP3)使用相同的方法.

Another interesting part about GPL is that it states that application that links to a GPL library is a derivative work. It means that if you will make a minimalistic open source application that links to MySQL client libraries and communicates with MySQL server, defines an API interface and dynamically loads your commercial/closed-source library which will export only that defined API implementation, you will not violate license terms and conditions because in that case open source application will be a user of closed-source product. The same approach is used by commercial graphics drivers (like NVidia) and audio codecs (like MP3).

这篇关于通过C ++访问MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆