G'Day all,
Thought I'd make a post to see what other people think of something I
just started to think about.. I'm developing a swing based App, at the
moment during development i'm switching between using mySql & hsqldb as
my database for the app(Just because I find the gui's available for
mysql easier to use, but the final version will be in hsqldb,maybe..)
Anyway I started to think about what happens in the future when
hopefully I have a user base and make changes to my application which
require changes to the database. Say for example I add a new column to
one of my tables, well I suppose in the startup code I can check for the
existance of that particular column and create it if it isnt there
already. Which led me to think rather than ship a already existing
database, why dont I have a routine at startup that checks for the
existance of a database, and creates it and then checks for the
existance of each table/column.
Is this a common approach ?
It would make my life eaiser in the sense each time I make a change to
my database using mysql I also have to make the change to hsqldb, recopy
the hsqldb to my directoy used by my installer generator blah blah when
really if the change is made once in my startup procedure then it doesnt
matter what db I'm using.
Rgds,
Thomas Hawtin - 31 Aug 2005 19:00 GMT
> Anyway I started to think about what happens in the future when
> hopefully I have a user base and make changes to my application which
[quoted text clipped - 7 lines]
>
> Is this a common approach ?
It's usual to provide some kind of utility to create/upgrade databases.
After the first version, you might find it useful to have the code that
creates the database create the version 1 schema and then upgrade that.
You will have to go back and write the upgrade code anyway, so you might
as well not duplicate the effort.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
Dave Brown - 31 Aug 2005 20:39 GMT
>> Anyway I started to think about what happens in the future when
>> hopefully I have a user base and make changes to my application which
[quoted text clipped - 16 lines]
>
> Tom Hawtin
Hi,
There is a difference though in what I want to do, as opposed to just
have the create statements, I will need to do a comparison to an
existing schema, if one is there... I wonder if theres any schema
comparison code out there already.. time for google....
Joan - 31 Aug 2005 21:32 GMT
> G'Day all,
>
[quoted text clipped - 26 lines]
>
> Rgds,
On one of my projects last year I have a method I can call that
only needs
the database name and the table name and it returns an Object[][]
of the
table data, a String[] of the column names, int numRows, int
numCols.
BUT, of course, in order to maintain your sanity, you need to
know what
the data is before you can program something to deal with it. For
example,
is it stock market data; high, low etc. or is it monthly sales of
chocolate;
city, pounds, price.
I don't see how your arrangement where you change the database
and expect
the program to still work the same unless you are ignoring the
new info.
Dave Brown - 31 Aug 2005 21:59 GMT
>> G'Day all,
>>
[quoted text clipped - 36 lines]
> I don't see how your arrangement where you change the database and expect
> the program to still work the same unless you are ignoring the new info.
I doubt I'll be needing to change any existing columns but I can see new
columns and new tables being the most likely changes that will have to
be made...