Execute the below script to programatically create a new application in CloudIO Platform for Oracle database
Make sure to update db_url, username, password, sub_domain, org_name, org_code before executing the below script
Bounce the web server after running the below script and click on the "DB Sync" button on the "Clear Cache" screen under the "File -> Administration" menu.
SET DEFINE OFF;

SELECT ra_orgs_s.NEXTVAL FROM DUAL;

INSERT INTO ra_orgs (org_id,
                     org_name,
                     org_code,
                     db_url,
                     username,
                     password,
                     sub_domain,
                     db_type,
                     db_driver,
                     description,
                     contact_person,
                     contact_phone,
                     contact_email,
                     max_users,
                     max_templates,
                     creation_date,
                     created_by,
                     last_update_date,
                     last_updated_by,
                     start_date,
                     end_date,
                     channel_id,
                     max_connection,
                     connection_expiry,
                     statement_cache,
                     dedicated_db,
                     max_pool,
                     db_version,
                     map_key,
                     default_date_format,
                     default_theme,
                     auth_provider,
                     enable_pwd_policy,
                     enable_pwd_policy_admin)
     VALUES (ra_orgs_s.CURRVAL,
             'My App', -- Application Name
             'MYA', -- Three char code, must be unique
             'jdbc:oracle:thin:@mydomain.com:1521:xe', -- JDBC URL for the application schema
             'username', -- application schema username
             'password', -- application schema password
             'myapp', -- e.g. myapp.example.com
             'ORACLE',
             'oracle.jdbc.OracleDriver', -- JDBC driver for Oracle
             NULL,
             'Admin',
             '333-222-4444', -- Admin phone number
             'admin@example.com', -- Admin email address
             100,
             100,
             SYSDATE - 1,
             1,
             SYSDATE - 1,
             1,
             SYSDATE - 1,
             NULL,
             1,
             200,
             '360000',
             'Y',
             'Y',
             15,
             NULL,
             NULL,
             NULL,
             'gray',
             'native',
             'N',
             'N');

SELECT ra_users_s.NEXTVAL FROM DUAL;

INSERT INTO ra_users (user_id,
                      user_name,
                      email_address,
                      password,
                      org_id,
                      mgr_id,
                      creation_date,
                      created_by,
                      last_update_date,
                      last_updated_by,
                      start_date,
                      end_date,
                      last_password_changed,
                      display_name,
                      orig_user_id,
                      resource_id,
                      trace_enabled)
     VALUES (ra_users_s.CURRVAL,
             'ADMIN', -- DO NOT CHANGE THIS. Username should be ADMIN
             'admin@example.com', -- admin email address
             '$2a$10$7Ic1vkIowIwzNayx7t01me7Z55SlSsWhO97kOF5jY.gtS/lSw.Y2y', -- welcome as the initial password
             ra_orgs_s.CURRVAL,
             NULL,
             SYSDATE - 1,
             1,
             SYSDATE - 1,
             1,
             SYSDATE - 1,
             NULL,
             SYSDATE - 1,
             'Admin',
             NULL,
             NULL,
             'N');

INSERT INTO ra_user_roles (org_id,
                           user_id,
                           role_id,
                           creation_date,
                           created_by,
                           last_update_date,
                           last_updated_by,
                           start_date)
     VALUES (ra_orgs_s.CURRVAL,
             ra_users_s.CURRVAL,
             (SELECT role_id
                FROM ra_roles
               WHERE org_id = 0 AND role_code = 'administration'),
             SYSDATE - 1,
             1,
             SYSDATE - 1,
             1,
             SYSDATE - 1);

INSERT INTO ra_user_roles (org_id,
                           user_id,
                           role_id,
                           creation_date,
                           created_by,
                           last_update_date,
                           last_updated_by,
                           start_date)
     VALUES (ra_orgs_s.CURRVAL,
             ra_users_s.CURRVAL,
             (SELECT role_id
                FROM ra_roles
               WHERE org_id = 0 AND role_code = 'developer'),
             SYSDATE - 1,
             1,
             SYSDATE - 1,
             1,
             SYSDATE - 1);

COMMIT;

Location

101 California Street, Suite 2710
San Francisco, CA 94111


440 N. Wolfe Rd.
Sunnyvale, CA 94085


Office 11, 5th Floor, Building 9,
Mindspace IT Park
Hyderabad 500081

p: +1 (844) AT CloudIO (844-282-5683)
f: +1 (650) 300-5247 | e: sales@cloudio.io
© 2009, 2017 CloudIO Inc. | Terms of Use | Privacy Policy