Wednesday, 2 January 2013

Questions about the MariaDB C Connector

I should first start this blog post with the acronym IANAL (I am not a lawyer).  Also the views in this post are mine and not my employer's (a lawyer did ask me to say that part).

Questions on the MariaDB JDBC Driver have already been raised so I wanted to do something similar for the MariaDB C Connector.  The JDBC's issues are mostly ethical whereas my C Connector questions are mostly legal.

But first a little history...  MySQL 3.23.58 was the last version to include an LGPL licensed connector for MySQL, the connector went GPL (and of course commercial) after this version.  Nowadays the connector is GPL with a FLOSS exception, that exception allows you to compile with certain other licensed software.  The main reason for this is PHP version 4 switched from a dual-licensed under the GPL to PHP licensed only.  The PHP license is incompatible with GPL and LGPL licensed in both directions, this is because clauses 3&4 of the PHP license conflicts with clause 6 of the GPL license (which is also clause 10 of the LGPLv2 license).  The FLOSS exception isn't in 3.23.58, it wasn't needed back then.

Why is this relevant?  The MariaDB C Connector is based on the LGPL 3.23 connector and is coded-up to have the current features of the MySQL connector.  Some of this is based on the PHP licensed MySQLnd connector.

Being LGPL licensed is one of the main selling points of the connector.  It means you can dynamically link the library with a commercial application.  Something you would have to buy a license for to do with the MySQL connector.

So, my questions are:

1. How can MariaDB's C Connector legally include LGPL and PHP licensed code in the same source under the LGPL umbrella?

2. There are questions around the licensing and availability of the native LGPL SDBC (OpenOffice) driver that other parts of the connector are based on.  In the comments of another blog post it was claimed it that the SDBC code was "... developed by MySQL in 2006 and 2007 and never reached GA – discontinued when Sun Microsystems acquired MySQL AB" but I haven't seen any evidence of this.  The only Sun code I can find for SDBC is 2008/2009 and LGPLv3 which can't be re-licensed as LGPLv2.  Now there is a newer MySQL SDBC driver which is Apache2 licensed.  Where can we find the code MaraDB based their work on?

3. Although not distributed in the packages there are GPL licensed test cases in the bzr source.  Can you globally call it LGPL with these in there?

I do hope answers to these can be put to rest so that customers can continue to be happy using the alternative connector.


  1. The answer to the third question should be a clear "yes". What matters to end users is the license of the library itself (where your first questions are relevant). Using a GPL licensed test suite, or Emacs or GCC to produce the library do not change the license of the library itself.

    Of course, if someone was to be speaking about the contents of the bzr repository, then it's true that it contains also GPL licensed code, but the point is just that this code is not used by end users who link the library into their applications.

    Btw: It is good to point out that when the 3.23 library was LGPL, then that is the reason why no FLOSS exception was needed, because the point of the LGPL license is to be compatible with any license. So the license of PHP was not relevant back then. The situation is different when you actually mix code into the library itself. But for simply consuming the MySQL library to enable PHP or anything else to connect to MySQL, there is no demands from the LGPL license.

    1. I think you are right about the third question. But from every source I can find and everyone I have asked (asked open source lawyers off-the-record) LGPL isn't compatible with PHP license, even for linking. FLOSS exception wasn't needed because we are still in PHPv3 (GPL) land when MySQL 3.23 was around so the licensing wasn't an issue.

    2. I'm still not convinced about your lawyers wrt LGPL. The whole point of LGPL is that I can use an unmodified LGPL library in any application, with any license, including my own very restrictive proprietary license. It's just not credible to claim that out of all the licenses in the world, everything else is fine, but linking with something using the PHP license is a problem.

      This is not a relevant discussion wrt the mixing of code that happens in the MariaDB library though. I just wanted to highlight it so we don't have more confusion.

    3. That is the point of the license, yes. The key point is derivative work section of the LGPL. People tend to be split on whether dynamic linking constitutes derivative work, if it does then license such as PHP and Apache 1.1 clash with LGPL due to the copyleft issues.

      But as you say, this is off-topic and probably something for FSF or alike to comment on.

  2. Here is a quick answer to your questions:

    As far as I have been able to find out it's ok to take PHP code and add it to a LGPL or GPL project.

    It's not possible to take GPL code and add it to PHP. Adding LGPL code as a library to PHP code is allowed, but discouraged. (The last is from the PHP licensing page:

    The reason for all this is that the PHP license is less restrictive than LGPL. However the PHP license is not conflicting with LGPL.

    I don't know the history of the LGPL SDBC driver. Never got access to this one.Don't understand what you mean when you suggest that this is related to MariaDB code.

    Yes, this is fine as there is no GPL code used in the generated libmariadb packages. (You are, in this context, only affected by the GPL if the source code of your compiled and distributed library contains GPL code).

    1. That link talks about linking (which may or may not be allowed, I believe Stallman is against it for example), but mixing/re-licensing source is another matter entirely.

      Georg said that part of the 2006/2007 SDBC driver was used in the MariaDB driver. In the comments of Baron's blog post.

  3. The initial SDBC driver was developed on top of mysqlnd, After the Sun/MySQL acquisiton there was no need for this driver and Sun published a sdbc driver based on libmysql.
    I did some reasearch, but it seems that this code is no longer available (OO,org source repos and

  4. You can link LGPL with any kind of code. This is how Stallman designed it.
    And according to both the PHP license and the LGPL license it's allowed to combine and link PHP and LGPL code. One issue is that the PHP project don't allow LGPL code in it, but that is not what this discussion is about.