The Business Rules Engine

Applications and Datasources

Create Datasource

create_datasource := CREATE DATASOURCE <datasource_name> 
                     [ DISPLAYED AS '<display_name>' ]? 
                     ( <datasource_property> = '<property_value>' [ , ... ]* )
                     [ WITH OPTIONS (
                          <datasource_option> = '<option_value>' 
                          [ , ... ]* ) 
                     [ USING ADMIN 

Creates a new datasource for Coda applications to use. Each of the 5 database properties must be defined for each datasource.

  • Hostname: The hostname or IP address of the database server to connect to for this datasource.
  • Username: The database username for the connection.
  • Password: The password for that username.
  • Schema: The schema for the database. For each type of database this might be formatted differently, based on that database's JDBC drivers.
  • Driver: The Coda driver to use. To use the built-in HSQLDB driver, for instance, this would be "org.codalang.codaserver.hsqldbdriver.HSQLDBDriver".

Certain database drivers may also require or request that you provide additional options to make your connection. You can specify these options as name/value pairs using the WITH OPTIONS clause.

Finally, Coda also has the capability to create your schema if it isn't already present. To accomplish this, specify a database username and password that has the appropriate permission level on the host database to create schemas by using the USING ADMIN clause.

Alter Datasource

alter_datasource := ALTER DATASOURCE <datasource_name> [
                    SET DISPLAY '<display_name>'  | 
                    RENAME TO <datasource_name> | 
                    SET  <datasource_property> = '<property_value>' [ , ... ]* | 
                    SET OPTION o<datasource_option> = '<option_value>' [ , ... ]*
datasource_property := HOSTNAME | USERNAME | PASSWORD | SCHEMA | DRIVER  

Alters an existing datasource. For the datasource properties and options, multiple name/value pairs can be specified with a single call.

Drop Datasource

drop_datasource := DROP DATASOURCE <datasource_name>

Removes the datasource permanently from the system. Please note that datasources cannot be dropped if they are used as the development datasource for an active application. To remove these, an alternative datasource must be assigned to the application using the ALTER DATASOURCE command first.

Create Application

create_application := CREATE [ GROUP ]? APPLICATION <application_name> 
                     [ DISPLAYED AS '<display_name>' ]? 
                     ON DATASOURCE <datasource_name> [ PREFIX <prefix> ]? 

Creates a new application.

The GROUP designation sets whether or not the application requires roles and permissions to be assigned to users through groups.

The datasource specified becomes the DEV datasource for the application. If it already contains a valid instance of the application, that is used for the deployment; otherwise, the datasource is formatted. Formatting is a destructive application, so be sure to proceed with caution. In the event of a format, the prefix specified is used to namespace the Coda system tables.

Alter Application

alter_application := ALTER APPLICATION <application_name> [
                     SET DISPLAY '<display_name>'  | 
                     RENAME TO <application_name> | 
                     SET <environment_name> DATASOURCE <datasource_name>
environment_name := DEV | TEST | PROD

Alters the application. To change the datasource of any of the environments, the datasource must first be formatted using the FORMAT command.

Drop Application

drop_application := DROP APPLICATION <application_name>

Drops the application permanently. All of the datasources associated with that application are free to be dropped.


format := FORMAT DATASOURCE <datasource_name> [
          FOR CODA ROOT IDENTIFIED BY '<password>'  | 
          FOR APPLICATION <application_name> PREFIX <prefix> 
          [ REVISION <revision_num> ]?

Formats a datasource in one of two ways:

  1. It can be a CodaServer database, in which you must specify a password for the root account.
  2. It can be a database for a particular application, in which case you must specify the application name and a prefix to namespace the Coda system tables. You can optionally specify a revision number to load the datasource to, if you want a particular version of your application deployed there; otherwise the most recent is used. You can see the revision history of the application through the appropriate SHOW and DESCRIBE commands.

Either of these two options is destructive to the data currently in the datasource. Please be sure that the datasource databases are empty or at least not used before formatting them.


promote := PROMOTE APPLICATION <application_name> ON [ 
           <environment_name> | 
           DATASOURCE <datasource_name>
           ] TO REVISION <revision_num>
environment_name := DEV | TEST | PROD

Promotes an application datasource to a particular revision of the application. This is a potentially destructive operation if later versions of the application drop tables, procedures, et al, so caution should be used and all data should be backed up before proceeding.

There are two ways to specify which datasource to update; indicate the environment to update (if the datasource is part of a deployed application) or specify the datasource by name.