Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 11 total
Thread error when using StarTransaction with the clientdataset.ApplyUpdates
Thu, May 1 2008 6:23 PMPermanent Link

Nirlan
delphi 2007 win32 R2
DBISAM 4.26 build 2

   
I am using the code below. (is not client server)
But an error occurs when the program runs the ApplyUpdates.

DBISAM Engine Error #10229 Transaction cannot lock
the database 'c:\system08\Program07


If I do not use the starttransaction, commit and rollback
the program works normally.

The same code worked with the firebird 2.1 and the ADS 9.0

Thanks for any help.


procedure TForm520.btnOKClick(Sender: TObject);
begin
 try
   DM.Database1.StartTransaction();
   ClientDS1.ApplyUpdates(0);
   DM.Database1.Commit(True);
 except
   on e:exception do
     begin
       ClientDS1.CancelUpdates;
       DM.Database1.Rollback;
       Application.MessageBox(e.Message) , 'Error', mb_ok + mb_IconError );
     end;
 end;
end;


procedure TForm520.DSprovider1UpdateError(Sender: TObject; DataSet: TCustomClientDataSet;
 E: EUpdateError; UpdateKind: TUpdateKind; var Response: TResolverResponse);
begin
 Raise Exception.Create(e.Message);
end;
Thu, May 1 2008 10:19 PMPermanent Link

Sean McCall
I don't use TClientDataset for anything but local buffering, but I would
suspect that the provider would apply the updates within in a
transaction. You can't call StartTransaction twice, so this may be the
problem. To see if this is the case you could try:

DM.Database1.StartTransaction();
DM.Database1.StartTransaction(); < this would give the same error


Nirlan wrote:
> delphi 2007 win32 R2
> DBISAM 4.26 build 2
>
>    
> I am using the code below. (is not client server)
> But an error occurs when the program runs the ApplyUpdates.
>
> DBISAM Engine Error #10229 Transaction cannot lock
> the database 'c:\system08\Program07
>
>
> If I do not use the starttransaction, commit and rollback
> the program works normally.
>
> The same code worked with the firebird 2.1 and the ADS 9.0
>
> Thanks for any help.
>
>
> procedure TForm520.btnOKClick(Sender: TObject);
> begin
>   try
>     DM.Database1.StartTransaction();
>     ClientDS1.ApplyUpdates(0);
>     DM.Database1.Commit(True);
>   except
>     on e:exception do
>       begin
>         ClientDS1.CancelUpdates;
>         DM.Database1.Rollback;
>         Application.MessageBox(e.Message) , 'Error', mb_ok + mb_IconError );
>       end;
>   end;
> end;
>
>
> procedure TForm520.DSprovider1UpdateError(Sender: TObject; DataSet: TCustomClientDataSet;
>   E: EUpdateError; UpdateKind: TUpdateKind; var Response: TResolverResponse);
> begin
>   Raise Exception.Create(e.Message);
> end;
>
Fri, May 2 2008 8:29 AMPermanent Link

Nirlan
startTransaction a double cause another error:

'Database already has an active transaction'

and not ' ...Transaction cannot lock  the database  ...'

any other suggestions?

thanks



Sean McCall <someone@somewhere.net> wrote:

I don't use TClientDataset for anything but local buffering, but I would
suspect that the provider would apply the updates within in a
transaction. You can't call StartTransaction twice, so this may be the
problem. To see if this is the case you could try:

DM.Database1.StartTransaction();
DM.Database1.StartTransaction(); < this would give the same error
Fri, May 2 2008 8:41 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Nirlan,

> DBISAM Engine Error #10229 Transaction cannot lock
This error usually means permissions problems.
Are you sure the current user has all the required permissions on this
directory?

> The same code worked with the firebird 2.1 and the ADS 9.0
It should work with DBISAM too.

--
Fernando Dias
[Team Elevate]

Fri, May 2 2008 9:25 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Nirlan,

<< I am using the code below. (is not client server)
But an error occurs when the program runs the ApplyUpdates.

DBISAM Engine Error #10229 Transaction cannot lock the database
'c:\system08\Program07

If I do not use the starttransaction, commit and rollback the program works
normally. >>

I'm using the following with 4.26:

procedure TForm1.Button2Click(Sender: TObject);
begin
  DBISAMTable1.Database.StartTransaction;
  try
     ClientDataSet1.ApplyUpdates(-1);
     DBISAMTable1.Database.Commit;
  except
     DBISAMTable1.Database.Rollback;
     raise;
  end;
end;

and it works just fine.  Are you sure that the error is occurring during the
ApplyUpdates ?  ApplyUpdates will only start a transaction if one isn't
already present.

If you posted all of the code and DFMs so that I can see the configuration
of the components, it would help immensely.  I suspect that there is an
issue with a session name or something similar.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, May 2 2008 3:54 PMPermanent Link

Nirlan
   
I discovered that the problem only occurs when the component is TDbisamSession with
property AutoSessionName = True.

I set AutoSessionName = False that worked.

Thank you all for help
Fri, May 2 2008 6:03 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Nirlan,

<< I discovered that the problem only occurs when the component is
TDbisamSession with property AutoSessionName = True.

I set AutoSessionName = False that worked. >>

Were all of the DBISAM components in the same data module ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, May 2 2008 6:51 PMPermanent Link

Nirlan
   
yes, the database and the session are in the datamodule.

the query, the clientdataset and provider are in the form.

Now I am with another problem.
Before commit I want to know what was the last number generated within the transaction
(code below),
but the query is returning the previous number.
( In the table T06_AREC there is a field autoinc )


   DM.Database1.StartTransaction();
   ClientDS1.ApplyUpdates(0);

   //  last number
   //  ========
   vTable := 'T06_AREC';
   DM.Query1.Close;
   DM.Query1.SQL.Clear;
   DM.Query1.SQL.Add( 'Select LastAutoInc( ' + #39 + vTable + #39 + ' ) as qUltimoNumero
from T03_CONF ' );
   DM.Query1.SQL.Add( 'Top 1' );
   DM.Query1.Open;

   DM.Database1.Commit(True);


Thank you for help.
Sat, May 3 2008 7:06 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Nirlan,

I couldn't reproduce your problem, and the only thing I could think of
is that maybe you are not getting a live result set for the query
connected to DSProvider1... Can you post the SQL of this query?

Also, I noticed you are selecting LastAutoInc FROM T03_CONF, which is a
different table. That is not the cause of your problem, but be aware
that if there is the possibility for this query to return an empty
result set then you will not get LastAutoinc.

--
Fernando Dias
[Team Elevate]
Sat, May 3 2008 8:39 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Nirlan,

<< yes, the database and the session are in the datamodule.

the query, the clientdataset and provider are in the form. >>

That was the cause - the query was probably not being assigned the same
SessionName property when AutoSessionName was set to True.

<< Before commit I want to know what was the last number generated within
the transaction (code below),
but the query is returning the previous number. >>

As Fernando indicated - are you querying the correct table ?  Also, is the
query component being used assigned to the same session via its SessionName
property ?  Transactions are separated by session, so a different session
wouldn't "see" the new record until after the commit.

--
Tim Young
Elevate Software
www.elevatesoft.com

Page 1 of 2Next Page »
Jump to Page:  1 2
Image