Page 1 of 3

UseMySqlDatabase()

Posted: Thu Sep 10, 2015 11:15 pm
by DoubleDutch
Now that you can write cgi and fcgi programs, it would be really handy to have a way of directly accessing a MySql database. Using an ODBC connector can be pretty complicated if you have just added the cgi script to a third party webserver.

Re: UseMySqlDatabase()

Posted: Fri Sep 11, 2015 9:57 am
by freak
This is asked a lot, but it is not possible due to the license of the mysql libraries.

Re: UseMySqlDatabase()

Posted: Fri Sep 11, 2015 11:22 am
by infratec

Re: UseMySqlDatabase()

Posted: Fri Sep 11, 2015 12:12 pm
by Fangbeast
Fred, isn't MariaDB a drop in replacement for MySql, written by the original MySql author?

Couldn't that be used somehow?

Re: UseMySqlDatabase()

Posted: Fri Sep 11, 2015 12:38 pm
by DoubleDutch
Fred: How about allow it if the libs are copied manually by the programmer to the correct place (before compilation) - that way it's up to them to sort out the licencing?

Re: UseMySqlDatabase()

Posted: Fri Sep 11, 2015 6:55 pm
by freak
DoubleDutch wrote:Fred: How about allow it if the libs are copied manually by the programmer to the correct place (before compilation) - that way it's up to them to sort out the licencing?
That would not help. The GPL states:
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange;
You cannot distribute the "complete" source code of a PB program, because you do not have the sources to the PB libraries which you use. The GPL only makes an exception for libraries that come as part of the OS, not libraries included with the programming language. Therefore its is impossible to distribute any compiled PB program that includes GPL code without violating the GPL. It doesn't matter who copied the library where.

Things are different with the LGPL, where the affected code can simply be compiled as a dll and the problems are solved.

Re: UseMySqlDatabase()

Posted: Fri Sep 11, 2015 6:59 pm
by freak
Fangbeast wrote:Fred, isn't MariaDB a drop in replacement for MySql, written by the original MySql author?

Couldn't that be used somehow?
If they have a compatible license and provide a client library then this may be an option.

Re: UseMySqlDatabase()

Posted: Fri Sep 11, 2015 7:44 pm
by GPI
https://mariadb.com/kb/en/mariadb/licen ... rary-for-c
Using the MariaDB client library for C

If your application is using a license that is not covered by the FLOSS exception, then you should use the new LGPL client libraries or C.

The LGPL license allows you to distribute these MariaDB client library freely with any application. If you modify the client library, you need to publish the new source code.
https://mariadb.com/kb/en/mariadb/licen ... sql-server
[...]If your application works with many databases, either natively or by using one of the database source independent frameworks, then you can freely distribute the MariaDB server with your application without being affected by the GPL.[...]

Re: UseMySqlDatabase()

Posted: Fri Sep 11, 2015 8:35 pm
by DoubleDutch
Freak: How about for code that is used internally - like a utility or something that runs on your own servers - not for sale?

Re: UseMySqlDatabase()

Posted: Fri Sep 11, 2015 8:39 pm
by DoubleDutch
UseMariaDatabase()

This would fix the problem, it also looks like it will work with MySQL db...

"It is also API compatible with the MySQL connector, allowing you to connect to legacy MySQL instances as well. "

Re: UseMySqlDatabase()

Posted: Fri Sep 11, 2015 11:05 pm
by freak
DoubleDutch wrote:Freak: How about for code that is used internally - like a utility or something that runs on your own servers - not for sale?
The GPL is mostly about distribution. If you don't distribute or sell it then I see no problem (that is just my interpretation. If in doubt, ask a lawyer).

Re: UseMySqlDatabase()

Posted: Fri Sep 11, 2015 11:08 pm
by DoubleDutch
If that is mentioned with the command then it should be able to be added, no?

Or the MariaDB version instead as that looks like there is no problem with distribution and works to connect to Maria or MySQL DB.

Re: UseMySqlDatabase()

Posted: Fri Sep 11, 2015 11:14 pm
by freak
We won't add a command which makes you unable to distribute the resulting executable. That makes no sense and is just a waste of work. Not to mention that including the PB library in PB also counts as distribution.

Re: UseMySqlDatabase()

Posted: Sat Sep 12, 2015 4:06 am
by DoubleDutch
huh?

"Or the MariaDB version instead as that looks like there is no problem with distribution and works to connect to Maria or MySQL DB."

Re: UseMySqlDatabase()

Posted: Sat Sep 12, 2015 12:48 pm
by coder14
http://www.purebasic.fr/english/viewtop ... 75#p293275
Fred wrote:It means than if you use this lib (dll or statically linked) in a non-GPL program you have a to buy a license to mysql.
I make use of libmysql.lib to access mySQL databases in client's web servers - you know the one that is pre-installed on most web hosts that is administered with cPanel and phpMyAdmin. But I do not distribute the libmysql.lib file or any other mySQL component with my compiled .EXE application (it is closed source paid application btw).

I charge less than $300 for my application and I have to pay $2000 for the license? :?: :?