Page 1 of 1

Transactions

Posted: Tue 14 Oct 2008 10:40
by MarkusG
Hi Forum.

im trying to use transactions with the oraComponents.
This is my way to implement it:

Code: Select all

OraSession.AutoCommit := False;
OraSession.StartTransaction(ilReadCommited, '', 'Test1');
// Table 'TEST' is empty => OK
OraQuery.SQL.Text := 'INSERT INTO test(id) values (1)';
OraQuery.AutoCommit := FALSE;
// Table 'TEST' is still empty => OK
OraQuery.ExecSql;
// Table 'TEST' is still empty => OK
OraSession.Commit;
// Table 'TEST' is still empty => NOT OK
After closing the app, all Data is correctly commited.
So, it could depend on the destruction of the Session.

The Session is in DirectMode

ODAC 6.50.0.36 for RAD Studio 2007
Oracle 9.2.0.5.0

Thanks for any ideas.

Regards
Markus

Posted: Wed 15 Oct 2008 06:46
by MarkusG
Hi Forum again,

the problem is solved!
My student has a local and a global instance of session with the same name.
So he wondered, why the global session wont work as expected.

We just kicked the local sessions and everything works fine.

Regards,

Markus

Posted: Wed 15 Oct 2008 11:37
by Plash
You should set the Session property of the TOraQuery component to the appropriate session if you have several TOraSession components in your program.