You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Tim Dudgeon <td...@informaticsmatters.com> on 2006/10/09 10:30:06 UTC

upgrading derby databases

I'm needing to make sure that I have  clear process for upgrading 
databases when I need to use a future version of Derby (e.g when 10.3 
comes out). I need to ensure that all current databases in use will be 
seemlessly and safely updated. In my application each user will have one 
or many (embedded) databases, each of which will need upgrading.

I understand that:
1. production versions of Derby will update from earlier production 
versions.
2. a "soft" upgrade can be performed allowing the newer version of derby 
to run against the old database files
3. a "hard" upgrade can be performed by specifying upgrade=true as a 
connection param which will update the database files to the new format.

I assume if would be good practice to allow a backup of the database 
before upgrading. To do this I need to determine if an upgrade is going 
to be needed, but I presumably can't do this until I've connected to the 
db. I also need to know whether an upgrade is goign to be needed so that 
the upgrade=true param can be supplied. So my options would see to be:

Either: store the version info as a external property which will be 
consulted prior to connecting to the db.

Or: connect using a soft upgrade, detect that the database needs to be 
updated (how do I do this? - will the DatabaseMetaData report the old 
version number or the new one?), perform the backup, and then ask user 
to restart so that connection can be made again and the "hard" upgrade 
performed.

Will the second approach work?
Any other issues to consider?


Many thanks

Tim