Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 85943 invoked from network); 7 Mar 2005 23:34:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 7 Mar 2005 23:34:42 -0000 Received: (qmail 44606 invoked by uid 500); 7 Mar 2005 23:34:41 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 44582 invoked by uid 500); 7 Mar 2005 23:34:41 -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 44569 invoked by uid 99); 7 Mar 2005 23:34:41 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FORGED_RCVD_HELO,SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from shawidc-mo1.cg.shawcable.net (HELO pd3mo1so.prod.shaw.ca) (24.71.223.10) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 07 Mar 2005 15:34:41 -0800 Received: from pd3mr6so.prod.shaw.ca (pd3mr6so-qfe3.prod.shaw.ca [10.0.141.21]) by l-daemon (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0ID0003H49HRU0D0@l-daemon> for derby-user@db.apache.org; Mon, 07 Mar 2005 16:34:39 -0700 (MST) Received: from pn2ml1so.prod.shaw.ca ([10.0.121.145]) by pd3mr6so.prod.shaw.ca (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0ID0008NI9HRF540@pd3mr6so.prod.shaw.ca> for derby-user@db.apache.org; Mon, 07 Mar 2005 16:34:39 -0700 (MST) Received: from spiff.localnet (S01060006257244ae.cc.shawcable.net [70.66.246.144]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0ID0000AS9HQGE@l-daemon> for derby-user@db.apache.org; Mon, 07 Mar 2005 16:34:38 -0700 (MST) Received: from [127.0.0.1] (unknown [192.168.1.100]) by spiff.localnet (Postfix) with ESMTP id 5FE1E46BF5 for ; Mon, 07 Mar 2005 18:34:43 -0500 (EST) Date: Mon, 07 Mar 2005 15:38:32 -0800 From: Trevor Squires Subject: Re: Inserting values in an identity column In-reply-to: To: Derby Discussion Message-id: <422CE5F8.1090806@protocool.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en References: User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi, I asked this very question last week (or so) for pretty much the same reason. It doesn't appear that you can alter the table to make it an identity column after creation (which was my first idea). I was also unable to find any way to switch off the identity feature temporarily either. One person suggested that derby ought to support something like "generated by default as identity" which makes sense - although I'd rather be able to just switch on and off the current behavior for loading of dumps and pre-population. In order to get my project out the door I ended up converting the logic to update/select rows in an "identities" table that I manage myself. HTH, Trevor Christian Rodriguez wrote: > Hi everyone, > > I am trying to import data from a mysql dump file. Basically, I need > to insert values in tables. Some of the tables in mysql include > auto_increment columns, that I have translated to "generate always as > identity" in derby. Now... the mysql dump file has values in those > columns, and I get an error when trying to insert a value into an > IDENTITY column in derby. How can I do this? > > I have a couple of ideas, but none work: > > 1. I could define the column as a regular column (not identity) and > after the values have been populated I could try to ALTER the column > in the table to make it an identity column, but this last part doesnt > seem posible. > 2. Is there another way to implement "autoincrement" in derby? > 3. Is it posible to disable the "identity" feature until all values > have been populated? > > Any other ideas? > > Of course, I could let derby generate values for that identity column > and then map the original values with those, and touch all the > references in the other tables and convert them to the new identity > values, but that doesnt seem like a lot of work... and Im getting the > feeling there should be a more reasonable way to import "dumps" from > other databases... > > Thanks for any help you can give me, > Xtian