Skip to Main Content
  • Questions
  • Autocommit in Cloud Applications (SQL Developer Web and Apex)

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Paul.

Asked: September 06, 2021 - 7:55 am UTC

Last updated: September 08, 2021 - 6:14 am UTC

Version: Oracle XE 18c

Viewed 1000+ times

You Asked

Hi.

Is there any way to dissable autocommit in Apex or SQL Developer web?

I tried with "set autocommit off" but it does not work.

select * from t_test

no items to display


insert into t_test values (1,2)

1 row inserted


rollback

select * from t_test


... and it shows the row inserted previously

Please find my question in stackoverflow:
https://stackoverflow.com/questions/68930342/dissable-autocommit-in-sql-developer-web-autonomous-database-oracle-cloud?noredirect=1#comment121820595_68930342

Thanks

and Connor said...

APEX and SQL Dev Web are *stateless*, ie, between calls there is no knowledge (state) of the previous call, thus an open transaction cannot be left open...In APEX's case, everything that is needed for the next call (values of items etc) will be stored in the database and then retrieved in the next call. And each call could be a different session, ie

- you send a request to us
- we allocate a session to do your work
- we do the work, return results to you if needed
- we release the session

The next call you do, will go through the same process, and thus may obtain a totally different session on the database.

Thus we *must* commit the moment we are going to return control to you.

If you have a series of DML's you would like to run "as one", throw into a PLSQL block which means all of it will complete or none of it will complete.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Nitpicker here...

Stew Ashton, September 07, 2021 - 11:07 am UTC

Can we really consider that APEX and SQL Developer Web are "stateless"? If that were the case, we could not stay logged in across page submits.

Maybe you mean that the Database sessions used by APEX and SQL Developer Web are stateless?

When you say "we" commit, I assume by "we" you mean ORDS? ORDS manages the connections / database sessions so it has to be the one guaranteeing they are stateless. It also has to commit if it changes any data due to REST calls, right?

Best regards,
Stew
Connor McDonald
September 08, 2021 - 6:14 am UTC

When you say "we" commit, I assume by "we" you mean ORDS? ORDS manages the connections / database sessions so it has to be the one guaranteeing they are stateless

Yup.

More to Explore

APEX

Keep your APEX skills fresh by attending their regular Office Hours sessions.