db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriele Kahlout <gabri...@mysimpatico.com>
Subject Re: Debugging lock timeouts - versuchen01X
Date Wed, 03 Mar 2010 08:20:09 GMT
Thank you for your answer. It solved it.

(this is uncommitted code)
private static Connection getConnection(final boolean autoCommit)
throws Exception{
		Connection con = null;
			con = DriverManager.getConnection("jdbc:default:connection");
		}catch(Exception e){
			con =  SqlWrapper.connectToDerby();
		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 <Knut.Hatlen@sun.com>:
> Gabriele Kahlout <gabriele@mysimpatico.com> 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=113#162
> If so, you may want to try to replace the following lines in
> refExpTablesComp():
> Connection con = null;
>     try{con = getConnection();}catch (Exception e){;}
> with
> Connection con = DriverManager.getConnection("jdbc:default:connection");
> and see if that makes it work.
> --
> Knut Anders

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) ∨ In(48h, TimeNow) ∨ ∃x. In(x, MyInbox) ∧ IsAnswerTo(x,
this) ∨ (In(subject(this), subject(x)) ∧ In(ACK, subject(x)) ∧
¬IsAnswerTo(x,this)) ⇒ ¬IResend(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.
∀x. In(x, MyInbox) ⇒ In(senderAddress(x), MySafeSenderList) ∨ (∃y.
In(y, subject(this) ) ∧ In(y,x) ∧ isCodeLike(y, -LICHT01X) ).

View raw message