Open topic with navigation

TIBCO ActiveSpaces® 4.8.0

# Defining a Table

Administrators define tables as needed to structure data. To define a table within the data grid, complete this task.

The examples in these steps illustrate adding commands to a configuration script. When the script is complete, the administration tool executes the script to define the table.

Alternatively, you can execute each step immediately as a separate administration tool command, instead of accumulating them in a script.

Statistics for a table or an index must be enabled at creation time and cannot be enabled or disabled afterward. For more information, see Enabling Statistics.
Before you beginA realm service must be running and reachable.

Either the realm must contain a valid data grid definition, or your configuration script file must contain commands to create a valid data grid definition.

Procedure
1. In a text editor, either begin editing a script file, or continue adding commands to an existing script.
   Follow the convention of naming your script with the .tibdg file name extension.
2. Add a script command to create the table. For example:

       table create table_name key_column_name key_column_type

       table create table_name key_col_1 col_1_type key_col_2 col_2_type

   Every table requires a primary key, which can consist of one or more columns. The first example creates a key with one column. The second example creates a key with two columns.
   The data type of key columns must be either long or string.
3. Define additional columns.
   For each column in the table, add a script command to create the column. For example:

       column create table_name column_name column_type

   Only the following FTL datatypes are valid as column types:
   - Long
   - Double
   - String
   - DateTime
   - Opaque
4. Optional. Define secondary indexes.

   For each index in the table, add a script command to create the index. For example:

       index create table_name index_name column_name

       index create table_name index_name column_1 column_2 column_3

   The data type of index columns must be either long or string.
5. Run the script to create the tables in the data grid.

       tibdg -s script_file_path

You can repeat this task to define additional tables. After creating the table, grant users or roles permissions to read from or write to the table.

Subtopics

Copyright © 2009-2022. Cloud Software Group, Inc. All Rights Reserved.