> I'd like to write and sell a Java application I've been designing
> but I'd need to use a database.
I'm in exactly the same situation, and did a bit of research.
> 1. Does JDBC supply that layer between the application and database.
Not entirely. You also need a database-specific driver. I say
database-specific, but on Windows there is a driver for ODBC. Of course,
that just pushes the database-specific issue one level further away,
as ODBC must have the right driver for the database.
> 2. Will I run into significant problems trying to write SQL
> statements that are generic?
There will definitely be issues. They may or may not be "significant
problems" depending on what you want to do. Some combinations of
database and driver will only scroll forward through resultsets
(BDE 5.1.1.1 and Paradox 8). Until fairly recently, MySQL didn't support
even basic subqueries (with any driver). In my modest experience,
support for DDL (e.g., CREATE TABLE) is much spottier and more erratic
than DML (e.g., SELECT). Keep in mind that there is no standard SQL
(well, through SQL-92, don't know everything that's in SQL-99) for
things as simple as creating an INDEX.
> 3. Has anyone ever written an application for distribution and
> run into copywrite issues by bundling a database. i.e. How/what
> do you do when an application uses a database and your selling the
> application to the general public.
If you want to be legal, you pay the license fees and pay attention
to the licensing restrictions of, for example, the GPL. In many cases,
the fees and/or restrictions may be the determining factor in your
selection of a bundled database. The royalty fee quote I got for
distributing MySQL as part of my planned project far exceeded the
intended retail price for the entire product! (Note that this is for
a commercial product. If I were releasing my project under the GPL,
the situation would be quite different.)
Be aware that you may have to license both the database itself and
the drivers needed by JDBC.
It's of no use for inexperienced customers, but you can always leave
an opening for the customer to configure their own JDBC datasource, and
leave the licensing issues for the database and its drivers to them.
If you do, you need to supply the expert customer with enough information
about the SQL you use for them to evaluate a database/driver combo and
see if it supports everything your app does. This is where the "generic
SQL" issue really kicks in. If you lock down the database/driver combo,
you can use any feature supported by that combo.
I suspect this is one reason products like ThumbsPlus (excellent product
from
www.cerious.com) end up distributing Access. Not because Access
is especially good, but because it's cheap to distribute on the Windows
platform.