Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 33046 invoked from network); 9 Dec 2008 13:55:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Dec 2008 13:55:47 -0000 Received: (qmail 48551 invoked by uid 500); 9 Dec 2008 13:55:59 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 48519 invoked by uid 500); 9 Dec 2008 13:55:59 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 48508 invoked by uid 99); 9 Dec 2008 13:55:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Dec 2008 05:55:59 -0800 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [192.18.43.132] (HELO sca-es-mail-1.sun.com) (192.18.43.132) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Dec 2008 13:55:44 +0000 Received: from fe-sfbay-10.sun.com ([192.18.43.129]) by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id mB9DtK2P017225 for ; Tue, 9 Dec 2008 05:55:20 -0800 (PST) Received: from conversion-daemon.fe-sfbay-10.sun.com by fe-sfbay-10.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0KBM00D013ZOHB00@fe-sfbay-10.sun.com> (original mail from Richard.Hillegas@Sun.COM) for derby-user@db.apache.org; Tue, 09 Dec 2008 05:55:20 -0800 (PST) Received: from richard-hillegas-computer.local ([129.150.16.108]) by fe-sfbay-10.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0KBM008JL406OU10@fe-sfbay-10.sun.com> for derby-user@db.apache.org; Tue, 09 Dec 2008 05:55:18 -0800 (PST) Date: Tue, 09 Dec 2008 05:55:19 -0800 From: Rick Hillegas Subject: Re: procedure to upgrade or create an embedded database In-reply-to: <501523869.11193241228777750399.JavaMail.javamailuser@localhost> Sender: Richard.Hillegas@Sun.COM To: Derby Discussion Message-id: <493E78C7.90608@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=UTF-8 Content-transfer-encoding: 7BIT References: <501523869.11193241228777750399.JavaMail.javamailuser@localhost> User-Agent: Thunderbird 2.0.0.18 (Macintosh/20081105) X-Virus-Checked: Checked by ClamAV on apache.org Hi Brian, Specifying "upgrade=true" on an already upgraded database should be harmless. Here's how to determine if the database needs to be upgraded: 1) The database needs to be upgraded if the (two digit) on-disk version of the database is less than the leading two digits of the Derby release identifier. 2) The on-disk version of the database can be obtained by the following query. Note this is not part of Derby's public API and so could change in the future. However, this part of the API has remained stable for the last 4 years: values ( syscs_util.syscs_get_database_property( 'DataDictionaryVersion' ) ) 3) The release identifier can be obtained via sysinfo. Hope this helps, -Rick publicayers@verizon.net wrote: > How do I tell if the database needs to be upgraded? Or is there no > impact if I specify "upgrade" but one is not necessary? > > Brian > > > On Mon, Dec 8, 2008 at 8:43 AM, Rick Hillegas wrote: > >> Brian Peterson wrote: >>> I'm trying to figure out how to determine what connection parameters >>> for an >>> embedded database I should use when there might not be a database in >>> place >>> (so "create=true"), or there might be an older version already in >>> place (so >>> "upgrade=true"), or there might already be a database of the right >>> version >>> in place (so "create" or add nothing to the URL). >>> >>> I read that "upgrade" and "create" cannot both be specified in the >>> connection URL. If I'm putting out a release of my application that >>> uses the >>> latest version of Derby (10.4) while a previous version used 10.2.2, >>> what >>> are the recommended steps for making the connection to the Derby >>> database if >>> one is already present? (Note that I have to handle this >>> programmatically as >>> part of the application startup.) >>> >>> Do I first try a URL with "create" and see if there's an error, and >>> if so, >>> follow up with a call with "upgrade"? Or do I have the procedure >>> always use >>> "upgrade" and follow up with a URL with "create" if it fail to make a >>> >> Hi Brian, >> >> Your first approach sounds good to me: >> >> 1) Bring up the database, specifying "create=true" >> >> 2) If you get the warning that the database already exists, then >> bring down the database and reboot it in upgrade mode >> >> Regards, >> -Rick >>> connection? >>> >>> Brian >>> >>> >>> >>>