Return-Path: Delivered-To: apmail-incubator-ibatis-user-java-archive@www.apache.org Received: (qmail 61252 invoked from network); 10 May 2005 21:14:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 May 2005 21:14:53 -0000 Received: (qmail 12113 invoked by uid 500); 10 May 2005 21:18:14 -0000 Delivered-To: apmail-incubator-ibatis-user-java-archive@incubator.apache.org Received: (qmail 12052 invoked by uid 500); 10 May 2005 21:18:13 -0000 Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Precedence: bulk Reply-To: ibatis-user-java@incubator.apache.org List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 12026 invoked by uid 99); 10 May 2005 21:18:13 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from server3.3mountain.com (HELO server3.3mountain.com) (69.20.125.225) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 10 May 2005 14:18:13 -0700 Received: from [192.168.1.151] (ip67-153-106-58.z106-153-67.customer.algx.net [67.153.106.58]) (authenticated bits=0) by server3.3mountain.com (8.12.11/8.12.11) with ESMTP id j4ALEW7A022124 for ; Tue, 10 May 2005 17:14:34 -0400 Message-ID: <42812435.6080705@xaymaca.com> Date: Tue, 10 May 2005 17:14:29 -0400 From: Vincent Organization: Aaxis User-Agent: Mozilla Thunderbird 1.0+ (Macintosh/20050505) MIME-Version: 1.0 To: ibatis-user-java@incubator.apache.org Subject: Re: Controlling connections References: <42811741.9000403@xaymaca.com> <2fe5ef5b0505101400361702fb@mail.gmail.com> In-Reply-To: <2fe5ef5b0505101400361702fb@mail.gmail.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N No, I was not. I just learned about another cool iBatis feature. :) Thanks, Vincent Brandon Goodin wrote: > you will get a different connection because it is not the same > transaction. Once you close your transaction your chances of getting > the id you want are unlikely. Are you using on your > inserts? > > Brandon > > On 5/10/05, Vincent wrote: > >>Hello All, >>I have a mysql database that I am doing an insert on. >>I also require the resultant ID to use in a subsequent insert. >>doing an INSERT INTO ... followed by a SELECT LAST_INSERT_ID() >>within the same connection will give me back the ID I require. >>Most of the time this is working fine in iBatis. Other times... >> >>PreparedStatement: INSERT INTO ... >>PreparedStatementLogProxy: {pstm-100071} >> >> ConnectionLogProxy: {conn-100072} Connection >>PreparedStatementLogProxy: {pstm-100073} PreparedStatement: SELECT >>LAST_INSERT_ID() >> >> ConnectionLogProxy: {conn-100075} Connection >>PreparedStatementLogProxy: {pstm-100076} PreparedStatement: INSERT >>INTO ... >>PreparedStatementLogProxy: {pstm-100076} >>Parameters: [0 <-- ouch, this is supposed to be the last_inserted_id ! >> >>also note the different connection ids. >> >>Short of converting my tables to innodb and using transactions >>is there a simple way to fix this? >> >>Using latest SQL Maps. >>Thank You. >> >>-- >>Plato is my friend, Aristotle is my friend, but my greatest friend is truth. >>- Isaac Newton >> -- Plato is my friend, Aristotle is my friend, but my greatest friend is truth. - Isaac Newton