From derby-user-return-2998-apmail-db-derby-user-archive=db.apache.org@db.apache.org Mon Dec 12 10:30:56 2005 Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 42383 invoked from network); 12 Dec 2005 10:30:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Dec 2005 10:30:56 -0000 Received: (qmail 21451 invoked by uid 500); 12 Dec 2005 10:30:54 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 21430 invoked by uid 500); 12 Dec 2005 10:30:53 -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 21419 invoked by uid 99); 12 Dec 2005 10:30:53 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Dec 2005 02:30:53 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.98.34] (HELO brmea-mail-3.sun.com) (192.18.98.34) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Dec 2005 02:30:52 -0800 Received: from phys-gadget-1 ([129.156.85.171]) by brmea-mail-3.sun.com (8.12.10/8.12.9) with ESMTP id jBCATV4n018027 for ; Mon, 12 Dec 2005 03:30:31 -0700 (MST) Received: from conversion-daemon.gadget-mail1.uk.sun.com by gadget-mail1.uk.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0IRD00J01RS2HB@gadget-mail1.uk.sun.com> (original mail from Kristian.Waagan@Sun.COM) for derby-user@db.apache.org; Mon, 12 Dec 2005 10:30:22 +0000 (GMT) Received: from [129.159.112.188] (khepri17.Norway.Sun.COM [129.159.112.188]) by gadget-mail1.uk.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTPA id <0IRD004MZRUKVF@gadget-mail1.uk.sun.com> for derby-user@db.apache.org; Mon, 12 Dec 2005 10:30:22 +0000 (GMT) Date: Mon, 12 Dec 2005 11:30:20 +0100 From: Kristian Waagan Subject: Re: cleaning derby db In-reply-to: <82dc60e00512110508u68b10785ne6d7fb2b1612e476@mail.gmail.com> To: Derby Discussion Message-id: <439D513C.4020108@Sun.com> Organization: Sun Microsystems Inc. MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7.12) Gecko/20050930 Thunderbird/1.0.7 Mnenhy/0.7.2.0 References: <82dc60e00512110508u68b10785ne6d7fb2b1612e476@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello Y., You could of course delete the database directory itself, but then you would have to recreate the database and schema/table definitions afterwards. Apart from that, I don't know of any other way to delete all records from the database in Derby than to issue a 'DELETE FROM ' for all tables in the database. You could try to use the trick described in Jira entry DERBY-268 (http://issues.apache.org/jira/browse/DERBY-268), where import with replace is used to delete/ovewrite the existing table. (The link listed is broken. Please open the reference manual on http://db.apache.org/derby/manuals/ and find the entry for SYSCS_UTIL.SYSCS_IMPORT_TABLE). I guess you have to choose the approach that suit your needs best based on your application characteristics. If you have additional questions, I (or somebody else on the list) will try to answer them. -- Kristian Yuval wrote: > Hi, > > I'm using Derby db in my application. I'm starting the db by using > Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); > > and starting ti by calling > > DriverManager.getConnection ("jdbc:derby:aaa;create=true"); > > > How can I delete all the records in my db? > > Thanks, > > Y.