Connecting to MySQL in Java without having to go GPL
I am writing a piece of software in Java that needs to connect to an online database in or开发者_JS百科der to collect some information! I want to sell this software under my company, but the problem is Oracle has licenced the JDBC driver under GPL, which, I am correct, means that I can not redistrubute the driver in any way, amongst other limitations!
The only alternative I can see is to use PostgreSQL, as the driver is licenced under BSD as far as I am aware, which means that you can basically do what every you like with it. But I have spoken with my web host, JustHost and they have basically said that they do not support PostgreSQL and have no plans to, so if I wanted to host a PostgreSQL database with them I would have to pay for a dedicated server, rather rudely may I add. They was quite honest though, and they did say it would be cheaper to transfer to another web hosting company who support PostgreSQL!
As a last resort, I could just use a simple text file to transfer the information. But my only worry here is security. Some of the information stored in the database is confidential, well, actually, the data that is most confidential it will be licence keys, and maybe emails. This is obviously for when I validate the users licence key upon first use. Maybe it's not so insecure though, I just thought it would be very easy for people to edit the file to suit there needs, etc.
I did think that some kind of php script to provide requested information from a text file that the Java would communicate with may be more secure, but again, I'm not a security expert so I don't know, especially seeing as though I am using a shared host and am not paying for 'https'!
So basically, I would like to know what you would do given my situation please. Have you experienced this dilema before? If so, what do you do? What would you recomend? etc.
You can use the MariaDB JDBC driver to talk to a MySQL server. It is LGPL instead of GPL.
You can sell your software, and simply list the database / driver as an installation requirement.
Include it in your documentation and job done.
The GPL doesn't mean that proprietary software can't talk to it. It's a prerequisite, not a part of your software.
Also see this similar question:
MySQL licensing and GPL
Update
Also note you can even charge your customer for you providing the service of installing the library. This allows it to form part of your bill, without the customer having to install it themselves.
What about a small server app that provides webservices to transfer the data? Then only that server app would actually need the JDBC driver.
Edit: For web services look into JAX-WS (here's the java.net reference implementation).
Using web serices you could encrypt the data using Java's built-in encryption library, transfer the encrypted date and decrypt on the client. Additionally you might transfer some hash (MD5 for example) for the data to ensure it has not been changed.
Not sure which bit of the GPL you think is precluding verbatim distribution? From a brief read of it I can see:
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; or,
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
http://www.gnu.org/licenses/gpl-2.0.html
精彩评论