Fog Creek Software
Discussion Board




Need a reasonable database for java and C++

Hi:

I inherited an application where part of the code is in C++ and the other part is in java. The application uses a database as the backend. The database is needed to store all the records as well as to analyze them.

Currently, they are using MySQL. But, to distribute the application with MySQL costs them additional $200 or so per each copy. So, they want to replace this DB with some other DB.

The kind of things we do in the database are:

1. Insert data into records using import. Basically, a fast loading into the DB is needed.

2. SELECT ... INTO. That is, based on some criteria we move the data into other tables.

3. DELETE ... FROM. That is we delete the data from one table, where the id is another table. Sort of set subtraction.

The rest of the operations are simple selects and probably every database that supports SQL will have.

My query is:

Do you know any database that supports my operations? From java as well as C++? And, cheap to distribute with my application?

The data requirements are, it should scale upto 250MB or so.

random developer
Saturday, November 15, 2003

MySQL is GPL. If your software relies on it and cannot work without it, then you'd either need to pay up the $200 (or reach another agreement with MySQL AB) -- or GPL your own product.

There are alternatives, like SQLite which are excellent, and public domain. However, it does not seem to make any business sense at this point - migrating to a new server, testing, ironing the bugs, changing installers, educating support, etc. will cost you several thousands (or even tens of thousands) of dollars in man hours. Unless your selling them by the thousands, you're probably much better off, _financially_ paying $200/copy to MySQL AB.

Ori Berger
Saturday, November 15, 2003

http://www.hwaci.com/sw/sqlite/

SQLite has a do-whatever-you-want-with-it BSD style license. Not as powerful as MySQL or PostgreSQL but it'll do 98% of what you want, and you can embed it in your app.

.
Saturday, November 15, 2003

I'll third the SQLite recomendation. It is indeed a fine piece of software. Also, it has both ODBC and JDBC drivers available, so you may need to spend very little time migrating.  The support on the mailing list and responsivenees to bug reports is exceptional. And commercial support is offered by the author if necessary. If you do not need to have a database server, I highly recomend SQLite.

Mike Swieton
Saturday, November 15, 2003

The open source Firebird database might be an option.  It's a full featured database server complete with views, stored procedures, triggers, etc.:

http://firebird.sourceforge.net/index.php

Herbert Sitz
Saturday, November 15, 2003

Sorry, should have added that Firebird has both ODBC and JDBC drivers so it might work for you.

Herbert Sitz
Saturday, November 15, 2003

Just throwing in a PostgreSQL recommendation - ODBC/JDBC compatible, bulk loading, and all the other nice things.

In addition, if you use it in Windows there is an application (DBManager) that makes things really easy.

N. Smith
Saturday, November 15, 2003

If you have to access the database from your C++ code, I'd certainly go with postgresql or firebird. If you're developing a desktop application, you might consider an in-process database like sqlite. On Windows there also is, of course, JET 4.0 and MSDE, which you can also both distribute free of charge. For those you'd have to use Sun's JDBCODBC-bridge, but that should work fine, especially for your quite small data-size requirements.

Usually it's considered rude to install server-side services such as databases on a client's desktop, so you might want to switch to a in-process database anyway. This solution, of course, is less stable and doesn't support concurrent accessing as well as a standalone database.

If you only need database access from the Java portion of your code, there's also Axion (http://axion.tigris.org/ ) and hsqldb (http://hsqldb.sourceforge.net/ ) as alternatives.

The most important difference with any of those is that MySQL's types don't port to other databases very well (auto_increment in MySQL become sequences in Postgresql).  So you will get a headache from porting your code.

Hope that helps

John Vance
Saturday, November 15, 2003

Hum, arnet Postgres and Firebird also GPL:ed? I think thats what he wants to get away from..

2c

Eric DeBois
Sunday, November 16, 2003

http://www.postgresql.org/licence.html


Sunday, November 16, 2003

Here's another open source SQL database for Java.

http://mckoi.com/database/

..
Sunday, November 16, 2003

Two more open source SQL database engines for Java:

http://www.drjava.de/smyle/
http://www.jepstone.net/tinySQL/

..
Sunday, November 16, 2003

"Hum, aren't Postgres and Firebird also GPL'ed? I think thats what he wants to get away from.."

His problem was that by packaging MySQL with his application MySQL AB declares that it's a GPL violation and demands to be paid per deployment.  I don't know whether it does actually violate the GPL, but I do know that MySQL AB is starting to try to bring in licensing fees so they treat it as a GPL violation.

Firebird is published under the Mozilla Public License, I believe, which is not as restrictive as the GPL.  So packaging Firebird with the application would be fine.

Don't recall what license PostgreSQL is published under, but I kind of doubt you'd want to deploy PostgreSQL with your application in a Windows install.  I don't even think the Windows-native version of PostgreSQL is available yet, is it.

If Sun has a JDBC to ODBC bridge there may be a few proprietary databases worth looking at.  E.g., NexusDB (www.nexusdb.com) or DBISAM (www.elevatesoft.com).  Both are written in Delphi and are popular within Delphi community.  Less than $1,000 to get client/server versions with ODBC drivers and unlimited royalty free deployment.

Herbert Sitz
Sunday, November 16, 2003

PostgreSQL has a BSD licence (it comes from Berkeley), but it's not a good choice as an small embedded DB.

Why don't you try Berkeley DB http://www.sleepycat.com , it doesn't provide an SQL interface but you don't seem to need complex queries anyway.

Alex Drahon
Monday, November 17, 2003

If you are on Windows, MSDE ?

Just me (Sir to you)
Monday, November 17, 2003

"SQLite has a do-whatever-you-want-with-it BSD style license."

Just a clarification on SQLite's license.

It does NOT have a BSD style license.

SQLite is in the public domain. There is NO license, you can do whatever you want with it, no restrictions at all.

But it's cool software for more than just that.

Chris Tavares
Monday, November 17, 2003

Just distribute MySQL and your app on separate CDs, or separate downloadable files.  That won't violate the GPL.  Read the GPL yourself and the GPL FAQ.

T. Norman
Monday, November 17, 2003

T. Norman's advice seems to me like the best so far.  Slightly more complicated install for customers -- but only slightly -- and it does away with the need for what could be loads of unnecessary effort just to switch db's because of a licensing problem.

Herbert Sitz
Tuesday, November 18, 2003

I would consult a lawyer before accepting the 2-CD advice. I don't know if it still does, but MySQL's FAQ addressed this specifically:

Something to the effect of: "If your software can't function without MySQL, then we consider your software derivative work". You can disagree, of course - but that's for a court to decide, I think.

It's a gray area. Morally, I think MySQL's line is reasonable. Legally, I have no idea.

If you have multiple database backends, though, and MySQL is just one of them, then you're OK; They specifically mentioned this case as what the consider proof that your program is NOT a derivative work of MySQL.

Ori Berger
Tuesday, November 18, 2003

The MySQL position is a ridiculous one.  That's like saying that any programs that run on top of an Oracle database (and only an Oracle database) is a derivative work of the Oracle database.  Or even that any native executable that runs on MS Windows is a derivative work of MS Windows.

Interoperability != Derivative work.

T. Norman
Tuesday, November 18, 2003

If they want to put more restrictive conditions on MySQL than the GPL allows, they shouldn't pretend it is licensed under the GPL, and should choose another license accordingly.

T. Norman
Tuesday, November 18, 2003

I agree completely with T. Norman. 

I was considering using MySQL for one of my own projects.  I am very confident that my use would be within the GPL, but contacted MySQL AB anyway because I wouldn't want to use their product if they consider my use to violate the GPL under their cockeyed interpretation of it.

Basically what I got from their salesperson was that if I have a commercial product and it connects with the MySQL database in any way -- including the mere sending of SQL statements to it!! -- then their position was it would require a commercial license.  Now this is obviously false, and even a step further down the line than considering it a violation but only if your program can use only MySQL and not another database.  But either position is absurd.

Some people may not realize it, but MySQL was not published under the GPL until perhaps 6 years ago.  Before that it was a commercially licensed database.  MySQL AB published under the GPL to stay alive and gain market share and now that they have gained that market share, they're in a certain sense trying to reverse course and have it both ways (i.e., commercial and open-source co-existing). 

Unfortunately, this creates a conflict of sorts for them in interpreting the GPL, because if they interpret the GPL as fairly non-restrictive they will have fewer situations where they can justifiably charge for the commercial license.  Problem is, they've chosen to adopt a ludicrously restrictive interpretation of the GPL.  And what's worse, they're now using some tactics that some might call FUD tactics to scare customers into paying for commercial licenses. 

My experience soured me on the company. 

As one example, take this text from their licensing page, where they explain that they do allow you to use the open-source MySQL with a commercial application, but only if you never distribute it -- even internally within a company --  in any way, including mere copying of the binaries!!  It's simply absurd:

-------------------------------------------------------------
As long as you never distribute (internally or externally) the MySQL Software in any way, you are free to use it for powering your application, irrespective of whether your application is under GPL or other OSI approved license or not.

More specifically:

Modifying - You are allowed to modify MySQL Software source code any way you like. If you distribute the modified version, all changes, all interface code and all code that connects directly or indirectly to the interface code fall under GPL.

Copying - You are allowed to copy MySQL binaries and source code, but when you do so, the copies will fall under the GPL license.
------------------------------------------------------------------

see http://www.mysql.com/products/licensing.html

Herbert Sitz
Tuesday, November 18, 2003

Before anyone suggests I'm being unreasonable towards MySQL AB, I should say that I am somewhat conflicted in my own attitude towards MySQL AB.

Yes, they do have an excellent product that many are able to use for free under the GPL.  Yes, even under commercial licensing their prices are dirt cheap.

I like open source, but I'm not a huge advocate.  I like commercial software fine, too.  If MySQL were available only under a commercial license, I would not think badly of the company. 

But the fact is that now they're saying things like the quote below, which is calculated to get people without a legal understanding of the GPL (i.e., most of their customers) to pay for commercial licenses even when that is highly, highly, unlikely to fall outside the GPL.  Sorry, but it's very close to other company's FUD tactics that open-source advocates know and hate:


---------------------------------------------------------------------
This is our licensing policy in brief: Our software is 100% GPL, and if yours is also 100% GPL (or OSI compliant), then you never have to pay us for the licences. In all other instances, you are better served by our commercial licence. Read the details below!
---------------------------------------------------------------------

Herbert Sitz
Tuesday, November 18, 2003

"you are better served" almost always means "we are better served".

It's up there with "it wouldn't be fair to [you, me, them, whoever's getting the shaft]."

Portabella
Wednesday, November 19, 2003

Since you use the MySQL client libraries, and they are GPLd, they might technically be correct. If you talk the MySQL protocol directly, I suppose you're correct.

Still, the definition of "derivative work" isn't clear cut. If you statically link it, we'd probably agree it is (for the purpose of Copyright law, anyway - there's a copy of the thing inside). If you dynamically link it, but don't provide the .DLL yourself, then you obviously have not violated copyright law. If you provide the DLL yourself in whatever form (even if you provide a copy identical to the one downloaded from the vendor), then you must comply with the GPL or you don't have any right to make that copy. And now we're back to what the court thinks - does your program constitute a derivative work or not.

I'd be much happier if some well defined standards were set, about what constitutes derivative work, and what isn't. Unfortunately, the current fog mostly works in favor of anyone who's in a position to make the change.

Ori Berger
Wednesday, November 19, 2003

Ori -- If you don't use the MySQL client libraries (instead using something like MicroOlap's MySQLDAC: http://www.microolap.com/products/dac/mysqldac.htm) and you just issue SQL statements to a MySQL server running in a separate process, then you're not linking anything to MySQL code at all.  Yet MySQL AB in many cases considers that to violate the GPL.

Herbert Sitz
Wednesday, November 19, 2003

Sounds reasonable to me; I hope it sounds that way to a court if it ever gets there.

I wasn't aware MySQL AB was going that far.

Ori Berger
Wednesday, November 19, 2003

*  Recent Topics

*  Fog Creek Home