Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: Problem with Transaction und DatabaseLinks
Problem with Transaction und DatabaseLinks
Posted: 2007/12/06 10:56
 
Hello,

I've tried now for a few hours to understand the problem.
Wenn I use this code I get a ora-01453 SET TRANSACTION muss erste Anweisung sein Error


  01  ADQuery.Active:=false; 02  ADQuery.Sql.Clear; 03  ADQuery.Sql.Add('SELECT MyCol FROM MyTable@LinkedDatabase WHERE ID=1'); 04  ADQuery.Active:= true; 05  showmessage(ADQuery.FieldByName('MyCol').AsString); 06 07  try 08    ADQuery2.Active:=false; 09    ADQuery2.Sql.Clear; 10    ADQuery2.Sql.Add('insert into MyTable@LinkedDatabase (MyCol )values(''test'')'); 11    ADConnection.StartTransaction; 12    ADQuery2.ExecSQL; 13    ADConnection.Commit; 14  except 15    ADConnection.Rollback; 16  end;



The showmessage appears with the corect value but then the exception comes.

I have restartet Oracle several times, but nothing changes, ssame problem

If I use it local without @LinkedDatabase it works fine.

When I only use the second statement with insert, it works too.

Post edited by: Timbo, at: 2007/12/07 02:25

Post edited by: Timbo, at: 2007/12/07 02:26

Post edited by: Timbo, at: 2007/12/07 03:11
Re:Problem with Transaction und DatabaseLinks
Posted: 2007/12/06 18:04
 
Hello

So, at which line the exception happens ?

Regards,
Dmitry
Re:Problem with Transaction und DatabaseLinks
Posted: 2007/12/07 02:26
 
At line 11

Post edited by: Timbo, at: 2007/12/07 02:40
Re:Problem with Transaction und DatabaseLinks
Posted: 2007/12/07 03:10
 
if I set line


 03  ADQuery.Sql.Add('SELECT MyCol FROM MyTable@LinkedDatabase WHERE ID=1');



to


 03  ADQuery.Sql.Add('SELECT MyCol FROM MyTable WHERE ID=1');



it works too
Don't know what to do...

Post edited by: Timbo, at: 2007/12/07 03:12
Re:Problem with Transaction und DatabaseLinks
Posted: 2007/12/07 03:25
 
Hello

Try to move StartTransaction before line 4.

Regards,
Dmitry
Re:Problem with Transaction und DatabaseLinks
Posted: 2007/12/07 03:39
 
YES that works:


  01  ADQuery.Active:=false; 02  ADQuery.Sql.Clear; 03  ADQuery.Sql.Add('SELECT MyCol FROM MyTable@LinkedDatabase WHERE ID=1'); 03  ADConnection.StartTransaction; 04  ADQuery.Active:= true; 04  ADConnection.Commit; 05  showmessage(ADQuery.FieldByName('MyCol').AsString); 06 07  try 08    ADQuery2.Active:=false; 09    ADQuery2.Sql.Clear; 10    ADQuery2.Sql.Add('insert into MyTable@LinkedDatabase (MyCol )values(''test'')'); 11    ADConnection.StartTransaction; 12    ADQuery2.ExecSQL; 13    ADConnection.Commit; 14  except 15    ADConnection.Rollback; 16  end;



Thank you very much...