From derby-user-return-12360-apmail-db-derby-user-archive=db.apache.org@db.apache.org Wed Mar 03 08:20:47 2010 Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 7840 invoked from network); 3 Mar 2010 08:20:47 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 3 Mar 2010 08:20:47 -0000 Received: (qmail 83996 invoked by uid 500); 3 Mar 2010 08:20:40 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 83716 invoked by uid 500); 3 Mar 2010 08:20:40 -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 83709 invoked by uid 99); 3 Mar 2010 08:20:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Mar 2010 08:20:40 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.220.209] (HELO mail-fx0-f209.google.com) (209.85.220.209) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Mar 2010 08:20:31 +0000 Received: by fxm1 with SMTP id 1so1385805fxm.15 for ; Wed, 03 Mar 2010 00:20:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.100.214 with SMTP id z22mr528002fan.104.1267604410041; Wed, 03 Mar 2010 00:20:10 -0800 (PST) X-Originating-IP: [193.206.186.101] In-Reply-To: References: <1f5d398f1003011116n663ac9e1i151c26601215cf83@mail.gmail.com> <4B8C25C0.3050406@sun.com> <1f5d398f1003011332h71f88741i28037f54bfda687e@mail.gmail.com> <1f5d398f1003011334h5cec9f5qee13e93c418b9bdb@mail.gmail.com> Date: Wed, 3 Mar 2010 09:20:09 +0100 Message-ID: <1f5d398f1003030020i7c9ff727q1b9a4c02d1dc524d@mail.gmail.com> Subject: Re: Debugging lock timeouts - versuchen01X From: Gabriele Kahlout To: Derby Discussion Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you for your answer. It solved it. (this is uncommitted code) private static Connection getConnection(final boolean autoCommit) throws Exception{ Connection con =3D null; try{ con =3D DriverManager.getConnection("jdbc:default:connection"); }catch(Exception e){ con =3D SqlWrapper.connectToDerby(); con.setAutoCommit(autoCommit); } return con; } Now, I'd like to ask the following question: Executing this, in my try-catch algorithm, this insertion throws an Exception. I then in the catch do things and the re-try it. However, different from SQLite, the RID (PRIMARY AUTOINCREMENT) is not the same as the previous, that failed. It seems that is wasted. Maybe if one rollsback the transaction it returns? But that is complicating in my atomic method. Other solutions, other than live with this extra complexity, or modify the = algo? st.executeUpdate(SqlWrapper.insert(objTable, batColumn, batch)); 2010/3/2, Knut Anders Hatlen : > Gabriele Kahlout writes: > >> java.sql.SQLException: The exception 'java.sql.SQLException: A lock >> could not be obtained within the time requested. The lockTable dump >> is: > > Hi Gabriele, > > Just a guess, but could it be that the stored procedure you call from > the trigger obtains a new connection to your Derby database instead of > running within the current connection? That could result in lock issues > like the ones you're seeing. > > Is this the code that's failing? > http://code.google.com/p/memorizeasy/source/browse/trunk/MemorizEasy/src/= com/mysimpatico/memorizeasy/engine/Database.java?r=3D113#162 > > If so, you may want to try to replace the following lines in > refExpTablesComp(): > > Connection con =3D null; > try{con =3D getConnection();}catch (Exception e){;} > > with > > Connection con =3D DriverManager.getConnection("jdbc:default:connection")= ; > > and see if that makes it work. > > -- > Knut Anders > --=20 Regards, K. Gabriele --- unchanged since 25/1/10 --- P.S. Unless a notification (LON), please reply either with an answer OR with " ACK" appended to this subject within 48 hours. Otherwise, I might resend. In(LON, this) =E2=88=A8 In(48h, TimeNow) =E2=88=A8 =E2=88=83x. In(x, MyInbo= x) =E2=88=A7 IsAnswerTo(x, this) =E2=88=A8 (In(subject(this), subject(x)) =E2=88=A7 In(ACK, subject(x)= ) =E2=88=A7 =C2=ACIsAnswerTo(x,this)) =E2=87=92 =C2=ACIResend(this). Also note that correspondence may be received only from specified a priori senders, or if the subject of this email ends with a code, eg. -LICHT01X, then also from senders whose reply contains it. =E2=88=80x. In(x, MyInbox) =E2=87=92 In(senderAddress(x), MySafeSenderList)= =E2=88=A8 (=E2=88=83y. In(y, subject(this) ) =E2=88=A7 In(y,x) =E2=88=A7 isCodeLike(y, -LICHT01X) = ).