Hi Rob,
Because of the difference between hard and soft-upgrade, there are two
version numbers which might be interesting:
1) The version number of the Derby code in the Derby jar files.
2) The version number of the data stored in a particular database.
You can get the answer to (1) by calling the DatabaseMetaData methods
getDatabaseMajorVersion() and getDatabaseMinorVersion(). E.g.:
connection.getMetaData().getDatabaseMajorVersion()
connection.getMetaData().getDatabaseMinorVersion()
You can get the answer to (2) as follows. Note that this technique is
not part of Derby's public API and could change in the future (although
it has remained stable for the past 6 years). The following method
returns a ResultSet with 1 row with 1 column which contains the
information you need:
connection.prepareStatement( "values
syscs_util.syscs_get_database_property( 'DataDictionaryVersion' )"
).executeQuery()
Hope this helps,
-Rick
On 6/14/11 11:30 AM, rob wrote:
Hi,
thanks for the answer and the link.
I have one more question: connecting to a derby database how can i
know its version?
Thanks
On 13 June 2011 22:28, Kathey Marsden<[email protected]> wrote:
On 6/13/2011 1:13 PM, rob wrote:
Hi,
sorry for the question, i am new to derby, i have some databases
created with derby 10.7, i would like to update to 10.8, my doubt is :
can i always open a database created with 10.7 with the 10.8
derby.jar?
From my tests seems ok, but just to be sure if someone more expert
than me can confirm this.
I see, and this is ok, that the opposite is not possible, i cannot
open a database created with 10.8 with 10.7 because the format is
different.
So there is some automatic format's conversion when you open a 10.7
database with 10.8?
Hi Rob,
When you connect to your 10.7 database with a newer version e.g. connect
'jdbc:derby:mydb' you are in what is called soft upgrade mode. You can
still run your existing application and go back to 10.7 but may not be able
to use some new features.
If you connect with the upgrade=true attributed, e.g.
'jdbc:Derby:mydb;upgrade=true' , this is called hard upgrade. The database
format will be changed to the newer version, any usage restrictions will be
lifted and you will not be able to go back to 10.7.
see:
http://wiki.apache.org/db-derby/UpgradingTen
I am not sure if any of the 10.8 features specifically require hard upgrade,
but generally I encourage users to perform hard upgrade once they have
verified their application with the new version. Moving forward it is the
most recent version that will get the most rigorous upgrade testing.
Kathey