endless loop in apex

This is part of my antipattern collection

I just stumbled across a new way how to create endless loops in Apex. I discovered it in some hidden corner in an application that I’m currently enhancing.

  1. Create a select list item
  2. Create a dynamic action that triggers “onChange”.
    The true action should be a javascript action that does: doSubmit(“someValue”);
  3. Add a page branch that redirects to the same page

So far no real problem.

4. Now change the true action to fire on page load.

The first load of the page is fine. But as soon as you click on the select list item and change the current value, the page starts an endless cycle of

“onChange event”

⇒ “javascript true action”

⇒ “submit processing”

⇒ “branching”

⇒ “page load”

⇒ “javascript true action”

⇒ “submit processing”

⇒ “branching”

⇒ “page load”

⇒ ….

Fortunatly you can simply kill the browser tab to stop it. 🙂

What do we learn from that?

Dynamic actions that fire on page load are EVIL!

working with editions – part 2

This is the second post about working with the edition based redefinition feature of the oracle database. The first post was about useful commands that help to set up editions inside an oracle database and enable schemas to use editioned objects.

This post will concentrate on different methods for connecting and setting a session to a specific edition.
It assumes that we already have three editions in our database :


connect using SQL*PLUS directly

  1. connect to the default edition
    Without any additional settings, the connect goes to the specified default edition of the database. E.g. ORA$BASE

    SQL> connect user/pwd@database 
    Connect done.
  2. Use environment Variable ORA_EDITION



  3. CONNECT with specific edition

    SQL> connect user/pwd@database edition=DEV$ALPHA
    Connect done.

so setting the edition works with SQL*plus.
Unfortunatly only a minority of tools support editions during the connect.

connect using TNSNAMES + DB Services

This will work with all tools including connections from applications servers, e.g. Apex/ORDS.

We can create different tnsnames entries that connect to a different db service name.

The db service can be configured to connect to a defined edition.

extra DB Service for different editions

  1. using servercontrol (important when Oracle Restart is used)
    srvctl add service -d db_unique_name -s service_name -t edition_name
  2. using plsql package to install DB services (starting from
    service_name => 'DEV_BETA',
    network_name => 'DEV_BETA',
    edition => 'DEV$BETA');
    service_name => 'DEV_ALPHA',
    network_name => 'DEV_ALPHA',
    edition => 'DEV$ALPHA');
    service_name => 'DEV_BASE',
    network_name => 'DEV_BASE',
    edition => 'ORA$BASE');
    select * from dba_services;

The name of the DB service is then used inside TNSNAMES.ORA for the service_name parameter (do not use SID!).

connect using JDBC

It is possible to set the edition for connections made via JDBC:OCI. To use that the OracleConnection class extention needs to be used.

Properties prop = new Properties();
prop.setProperty(OracleConnection.CONNECTION_PROPERTY_EDITION_NAME, "DEV$BETA");  

check the configuration (services and other relevant parameters)

select * from v$parameter
where regexp_like(name, 'edition|service|global|processes|sessions|dispatch|shared|listen')