Connect to Oracle from JVM inside database using a grid or RAC

Was:
ods.setDriverType("thin");
ods.setServerName("ocwgrid01.nbd.local");
ods.setDatabaseName("SCXD2");
ods.setPortNumber(1521);
ods.setUser("system");
ods.setPassword("ali120");

Is:
OracleDataSource ods = new OracleDataSource();
ods.setUser("system");
ods.setPassword("ali120");
ods.setConnectionCachingEnabled(true);
ods.setConnectionCacheName("MyCache");
ods.setFastConnectionFailoverEnabled(true);
ods.setONSConfiguration("nodes=ser1:4200,ser2:4200");
ods.setURL("jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=owlndb260)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=owlndb260)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=SCXD2)))");
Connection conn = ods.getConnection();

APEX Runtime only

If you have an Apex export from your development environment to install into your production environment, you might run into troubles when your production is Apex runtime only.

For an import to be successful, it is required to have a workspace. Create it using the following:

set serveroutput on size 1000000
set feedback off
-- This script can be run in sqlplus as the owner of the Oracle Apex owner.
begin
  wwv_flow_api.set_security_group_id(p_security_group_id=>1046129509285998);
end;
/
----------------
-- W O R K S P A C E
-- Creating a workspace will not create database schemas or objects.
-- This API will cause only meta data inserts.
prompt  Creating workspace ABC...
begin
wwv_flow_fnd_user_api.create_company (
  p_id                      => 1046207189286079,
  p_provisioning_company_id => 1046129509285998,
  p_short_name              => 'ABC',
  p_first_schema_provisioned=> 'ABC',
  p_company_schemas         => 'ABC',
  p_expire_fnd_user_accounts=> '',
  p_account_lifetime_days=> '',
  p_fnd_user_max_login_failures=> '');
end;
/

Now, note the security group id / provisioning company id. Check your export file(s) from your development environment and before importing into production change the identifier in the export file(s).

Once this is done it is safe to import the application using only an SQL prompt.

In this example, in production a workspace ABC is created identified by nr. 1046129509285998 and has corresponding database schema ABC, which is not required but more clear.

apexlib_tabform and ORA-00911: invalid character

When validating a report by looping its values (i.e. :)

for i in 1 .. apexlib_tabform.getrowcount loop
  v_num := apexlib_tabform.nv('ATTR_ID', i);
end loop;

You can get an ORA-00911 message. My first attempt was to enhance the procedure ApexLib_Util.debug to find out more. Interesting outputs, but no indication for a solution though.

After some complexity reduction on my query, I found the entire query is parsed to the ApexLib_TabForm package and gets mis-interpreted  because of an order by clause in the query.

So, the solution is to get rid of the order by and use the sort checkboxes on the Report attributes page instead.