The state of MySQL client libraries
Those who’ve been around the MySQL world are probably aware of the much-discussed topics of GPL licensing, dual licensing, and in particular, licensing of the client libraries (also called connectors or drivers) and the FOSS exception to that licensing. This is newly relevant with the announcement of a permissively-licensed MySQL-compatible client library for MariaDB.
The difference is that this time there’s been some question about the provenance and history of the source code. Some people asked me about this. Some of them were aware of a relatively obscure detail: there’ve been permissively licensed MySQL client libraries for years, in the form of libdrizzle, a BSD-licensed library for the Drizzle fork of MySQL.
Here are some of the thoughts that seemed to be going through peoples’ minds:
- This changes everything, doesn’t it? Now I don’t have to to open-source my application or pay Oracle licensing fees.
- Is the source code of these new connectors untainted, or am I exposing myself to liability problems by using it?
- Isn’t MariaDB’s driver just a copy-paste and LGPL relicense of the BSD-licensed Drizzle driver? Sure, that’s legal, but is it ethical?
- Are these connectors really compatible, or will they cause problems?
Many people seem constitutionally incapable of understanding the GPL. I consider myself forever done with discussions about what the GPL permits or forbids, so I won’t address that. But I thought some of these things were worth looking into, at least quickly.
In particular, I was curious whether the allegations of plagiarism on MariaDB’s behalf were true. So I downloaded the latest release of the Drizzle and MariaDB C libraries, unpacked the source code, and just took a quick look. Here’s what I found.
The first thing I wanted to check was the allegation that MariaDB’s drivers were just an LGPL wrapper or copy-paste of Drizzle’s libraries. A few minutes of study showed no obvious plagiarism from Drizzle’s source. The MariaDB drivers appear to have a lot more code, documentation, tests, and so on, and it looks to be organized very differently than the Drizzle drivers. Files are in different directory hierarchies, code appears to be split up among files very differently, files are named differently, and so on. After about ten minutes of reading source, I saw no code that looks similar. A cursory grepping of the source code also shows words like “infile” that appear only in the MariaDB code. If there’s plagiarism from Drizzle’s library source code, it’s going to take a little more work to find it. In fact, from what I see, the Drizzle libraries don’t implement all of the protocol’s features, and that tangentially answers one of the other questions about true compatibility.
The next question is about MariaDB’s code versus MySQL’s code. The MariaDB library’s source looks and feels very similar to MySQL’s source. This is no surprise to me. If Monty sat alone in a room and coded a library from scratch, based only on the MySQL protocol documents and his memory, I’d expect the result to look a lot like MySQL’s source code anyway. But when I opened some of the files, things got less clear to me. For example, the copyright header in include/my_list.h begins with this:
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
I was surprised. I thought I’d see a “clean-room” reimplementation of the protocol, with no relationship to MySQL’s source code. But this file appears to be the same code as MySQL’s, although the header says that the file is licensed under the LGPL. I compared that with the same header file in MySQL 5.6′s source code, and here’s the result:
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
So that file is licensed under the “viral” copyleft GPL version 2 only, not the more permissive LGPL version 2 or later. Did the license terms on that file get changed over time? I am not surprised to see Oracle erasing prior copyright history and updating it to show themselves as the owners, but did they change the license from LGPL to GPL too? One way to find out is to check the MySQL 5.0 source code, because that was released before Sun or Oracle entered the picture. Here’s the header file’s copyright notice for MySQL 5.0.28:
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
The license matches Oracle’s, although of course the copyright owner has changed since then. So it looks to me like Oracle didn’t change the license terms; they just updated the ownership information.
Some important questions arise from this. I’m not qualified to answer them because I’m neither a lawyer nor a MySQL historian, but I’m qualified to ask them and I’d surely like to know the answers:
- Is a legitimately LGPL-licensed copy of these header files available?
- What’s the origin of the triple copyright ownership listed in MariaDB’s header file, to include “MySQL Finland AB” and “TCX DataKonsult AB” ? What’s the relationship between these entities and MySQL AB?
I think that perhaps someone from Monty Program or SkySQL is in the best position to answer these questions; in fact, Monty himself is probably the most knowledgeable. I’m looking forward to understanding more of the history around the source code and its licensing and provenance.



I think you are mixing up the C and java connectors. The MariaDB java connector is a fork of the drizzle java connector. As for the C connector, it mixes LGPL code with PHP licensed code which can be dangerous as the two licenses are explicitly incompatible.
LinuxJedi
26 Dec 12 at 2:10 pm
Yeah, I only looked at the C code.
As far as the mixture of licenses, I want to know how that code came to be licensed as LGPL instead of GPL.
Xaprb
26 Dec 12 at 2:35 pm
It is a fork of the LGPL 3.23 library (it was LGPL back then) and the PHP licensed MySQLnd fills some of the gaps.
LinuxJedi
26 Dec 12 at 2:40 pm
Good to know.
Xaprb
26 Dec 12 at 9:41 pm
Although as far as I can tell the LGPL licensed 3.23 library didn’t have FLOSS exception. That means the inclusion of the PHP licensed code is a problem.
LinuxJedi
27 Dec 12 at 4:02 am
Hi,
The MariaDB client library is based on libmysql 3.23.58 source code ( https://kb.askmonty.org/en/lgpl-mysql-client-library-32358/ ).
New features like character set support and prepared statements are derived from PHP’s mysqlnd extension and from a native SDBC driver for OpenOffice under LGPL (which was developed by MySQL in 2006 and 2007 and never reached GA – discontinued when Sun Microsystems acquired MySQL AB).
New features like progress indication support, plugin api for authentication are written by MP.
LinuxJedi: “Although as far as I can tell the LGPL licensed 3.23 library didn’t have FLOSS exception. That means the inclusion of the PHP licensed code is a problem.”
This is wrong. MySQL client library has a FLOSS Exception, since several projects like PHP don’t allow linking against GPL licensed libraries.
The PHP code is licensed under PHP License (similiar to Apache/BSD), so it is not a problem to use part of PHP code in LGPL licensed mariadb client library (http://www.php.net/license/3_01.txt)
Just my 2 cents!
Georg
27 Dec 12 at 7:51 am
Was the FLOSS exception introduced when the licensing was changed from LGPL to GPL? Why would it have been necessary if the licensing had stayed LGPL?
Xaprb
27 Dec 12 at 8:58 am
http://www.gnu.org/licenses/license-list.html also applies to LGPL 2 due to clause 10 conflicting with clauses 2&3 of PHP 3.01 (according to a open source lawyer I asked). The two are incompatible with each other, it isn’t a one-way thing.
I highly doubt MySQL 3.23 connector had FLOSS exception, it wasn’t needed because PHP at the time was dual-licensed.
LinuxJedi
27 Dec 12 at 10:52 am
When was the SDBC driver published by MySQL AB or Sun microsystems?
James Day
27 Dec 12 at 11:29 am
I believe the SDBC beta 1 was on forge for a while (in 2009), but from the snippets I have seen it was LGPLv3 and since the MariaDB connector appears to be LGPLv2 it probably isn’t compatible either (since you can’t downgrade the license).
LinuxJedi
27 Dec 12 at 12:25 pm
This is a lot more complicated than I thought it would be. I wasn’t expecting to discover that there’s potentially worrisome murkiness about the licensing. I hope someone tries to clear it up with a blog post explaining it, so this isn’t the first thing someone finds when they search for more information about the licensing.
Xaprb
27 Dec 12 at 12:43 pm
https://code.google.com/a/apache-extras.org/p/aoo-my-sdbc/source/browse/LICENSE
Ryan Huddleston
1 Jan 13 at 3:22 am
Robert Hodges adds more information at http://scale-out-blog.blogspot.com/2013/01/questions-about-mariadb-jdbc-driver.html
Xaprb
1 Jan 13 at 9:57 pm
And there’s more from Andrew Hutchings: http://www.linuxjedi.co.uk/2013/01/questions-about-mariadb-c-connector.html
Xaprb
2 Jan 13 at 10:29 am
Stewart Smith says the Drizzle libraries’ licensing is unencumbered: http://www.flamingspork.com/blog/2013/01/03/on-the-clarity-of-licensing/
Xaprb
3 Jan 13 at 5:17 pm
Ivan Zoratti of SkySQL provides an official response here: http://izoratti.blogspot.com/2013/01/skysqlmariadb-connectors-some-answers.html There is more information on the source code improvements than the licensing, but some comments address parts of the licensing concerns.
Xaprb
5 Jan 13 at 9:11 pm