Skip to content

API Docs - v4.0.19

Store

rdbms (Store)

This extension assigns data sources and connection instructions to event tables. It also implements read write operations on connected datasources

Syntax

@Store(type="rdbms", jdbc.url="<STRING>", username="<STRING>", password="<STRING>", jdbc.driver.name="<STRING>", pool.properties="<STRING>", jndi.resource="<STRING>", datasource="<STRING>", table.name="<STRING>", field.length="<STRING>")
@PrimaryKey("PRIMARY_KEY")
@Index("INDEX")

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
jdbc.url The JDBC URL via which the RDBMS data store is accessed. STRING No No
username The username to be used to access the RDBMS data store. STRING No No
password The password to be used to access the RDBMS data store. STRING No No
jdbc.driver.name The driver class name for connecting the RDBMS data store. STRING No No
pool.properties Any pool parameters for the database connection must be specified as key value pairs. null STRING Yes No
jndi.resource The name of the JNDI resource through which the connection is attempted. If this is found, the pool properties described above are not taken into account, and the connection is attempted via JNDI lookup instead. null STRING Yes No
datasource The name of the Carbon datasource which should be used for creating the connection with the database. If this is found, neither the pool properties nor the JNDI resource name described above are not taken into account, and the connection is attempted via Carbon datasources instead. null STRING Yes No
table.name The name with which the event table should be persisted in the store. If no name is specified via this parameter, the event table is persisted with the same name as the Siddhi table. The table name defined in the Siddhi App query. STRING Yes No
field.length The number of characters that the values for fields of the STRING type in the table definition must contain. If this is not specified, the default number of characters specific to the database type is considered. null STRING Yes No

System Parameters

Name Description Default Value Possible Parameters
{{RDBMS-Name}}.maxVersion The latest version supported for {{RDBMS-Name}}. 0 N/A
{{RDBMS-Name}}.minVersion The earliest version supported for {{RDBMS-Name}}. 0 N/A
{{RDBMS-Name}}.tableCheckQuery The template query for the check table operation in {{RDBMS-Name}}. H2: CREATE TABLE {{TABLE_NAME}} ({{COLUMNS, PRIMARY_KEYS}})
MySQL: CREATE TABLE {{TABLE_NAME}} ({{COLUMNS, PRIMARY_KEYS}})
Oracle: CREATE TABLE {{TABLE_NAME}} ({{COLUMNS, PRIMARY_KEYS}})
Microsoft SQL Server: CREATE TABLE {{TABLE_NAME}} ({{COLUMNS, PRIMARY_KEYS}})
PostgreSQL: CREATE TABLE {{TABLE_NAME}} ({{COLUMNS, PRIMARY_KEYS}})
DB2.: CREATE TABLE {{TABLE_NAME}} ({{COLUMNS, PRIMARY_KEYS}})
N/A
{{RDBMS-Name}}.tableCreateQuery The template query for the create table operation in {{RDBMS-Name}}. H2: SELECT 1 FROM {{TABLE_NAME}} LIMIT 1
MySQL: SELECT 1 FROM {{TABLE_NAME}} LIMIT 1
Oracle: SELECT 1 FROM {{TABLE_NAME}} WHERE rownum=1
Microsoft SQL Server: SELECT TOP 1 1 from {{TABLE_NAME}}
PostgreSQL: SELECT 1 FROM {{TABLE_NAME}} LIMIT 1
DB2.: SELECT 1 FROM {{TABLE_NAME}} FETCH FIRST 1 ROWS ONLY
N/A
{{RDBMS-Name}}.indexCreateQuery The template query for the create index operation in {{RDBMS-Name}}. H2: CREATE INDEX {{TABLE_NAME}}_INDEX ON {{TABLE_NAME}} ({{INDEX_COLUMNS}})
MySQL: CREATE INDEX {{TABLE_NAME}}_INDEX ON {{TABLE_NAME}} ({{INDEX_COLUMNS}})
Oracle: CREATE INDEX {{TABLE_NAME}}_INDEX ON {{TABLE_NAME}} ({{INDEX_COLUMNS}})
Microsoft SQL Server: CREATE INDEX {{TABLE_NAME}}_INDEX ON {{TABLE_NAME}} ({{INDEX_COLUMNS}}) {{TABLE_NAME}} ({{INDEX_COLUMNS}})
PostgreSQL: CREATE INDEX {{TABLE_NAME}}_INDEX ON {{TABLE_NAME}} ({{INDEX_COLUMNS}})
DB2.: CREATE INDEX {{TABLE_NAME}}_INDEX ON {{TABLE_NAME}} ({{INDEX_COLUMNS}})
N/A
{{RDBMS-Name}}.recordInsertQuery The template query for the insert record operation in {{RDBMS-Name}}. H2: INSERT INTO {{TABLE_NAME}} ({{COLUMNS}}) VALUES ({{Q}})
MySQL: INSERT INTO {{TABLE_NAME}} ({{COLUMNS}}) VALUES ({{Q}})
Oracle: INSERT INTO {{TABLE_NAME}} ({{COLUMNS}}) VALUES ({{Q}})
Microsoft SQL Server: INSERT INTO {{TABLE_NAME}} ({{COLUMNS}}) VALUES ({{Q}})
PostgreSQL: INSERT INTO {{TABLE_NAME}} ({{COLUMNS}}) VALUES ({{Q}})
DB2.: INSERT INTO {{TABLE_NAME}} ({{COLUMNS}}) VALUES ({{Q}})
N/A
{{RDBMS-Name}}.recordUpdateQuery The template query for the update record operation in {{RDBMS-Name}}. H2: UPDATE {{TABLE_NAME}} SET {{COLUMNS_AND_VALUES}} {{CONDITION}}
MySQL: UPDATE {{TABLE_NAME}} SET {{COLUMNS_AND_VALUES}} {{CONDITION}}
Oracle: UPDATE {{TABLE_NAME}} SET {{COLUMNS_AND_VALUES}} {{CONDITION}}
Microsoft SQL Server: UPDATE {{TABLE_NAME}} SET {{COLUMNS_AND_VALUES}} {{CONDITION}}
PostgreSQL: UPDATE {{TABLE_NAME}} SET {{COLUMNS_AND_VALUES}} {{CONDITION}}
DB2.: UPDATE {{TABLE_NAME}} SET {{COLUMNS_AND_VALUES}} {{CONDITION}}
N/A
{{RDBMS-Name}}.recordSelectQuery The template query for the select record operation in {{RDBMS-Name}}. H2: SELECT * FROM {{TABLE_NAME}} {{CONDITION}}
MySQL: SELECT * FROM {{TABLE_NAME}} {{CONDITION}}
Oracle: SELECT * FROM {{TABLE_NAME}} {{CONDITION}}
Microsoft SQL Server: SELECT * FROM {{TABLE_NAME}} {{CONDITION}}
PostgreSQL: SELECT * FROM {{TABLE_NAME}} {{CONDITION}}
DB2.: SELECT * FROM {{TABLE_NAME}} {{CONDITION}}
N/A
{{RDBMS-Name}}.recordExistsQuery The template query for the check record existence operation in {{RDBMS-Name}}. H2: SELECT TOP 1 1 FROM {{TABLE_NAME}} {{CONDITION}}
MySQL: SELECT 1 FROM {{TABLE_NAME}} {{CONDITION}}
Oracle: SELECT COUNT(1) INTO existence FROM {{TABLE_NAME}} {{CONDITION}}
Microsoft SQL Server: SELECT TOP 1 FROM {{TABLE_NAME}} {{CONDITION}}
PostgreSQL: SELECT 1 FROM {{TABLE_NAME}} {{CONDITION}} LIMIT 1
DB2.: SELECT 1 FROM {{TABLE_NAME}} {{CONDITION}} FETCH FIRST 1 ROWS ONLY
N/A
{{RDBMS-Name}}.recordDeleteQuery The query for the delete record operation in {{RDBMS-Name}}. H2: DELETE FROM {{TABLE_NAME}} {{CONDITION}}
MySQL: DELETE FROM {{TABLE_NAME}} {{CONDITION}}
Oracle: DELETE FROM {{TABLE_NAME}} {{CONDITION}}
Microsoft SQL Server: DELETE FROM {{TABLE_NAME}} {{CONDITION}}
PostgreSQL: DELETE FROM {{TABLE_NAME}} {{CONDITION}}
DB2.: DELETE FROM {{TABLE_NAME}} {{CONDITION}}
N/A
{{RDBMS-Name}}.stringSize This defines the length for the string fields in {{RDBMS-Name}}. H2: 254
MySQL: 254
Oracle: 254
Microsoft SQL Server: 254
PostgreSQL: 254
DB2.: 254
N/A
{{RDBMS-Name}}.batchSize This defines the batch size when operations are performed for batches of events. H2: 1000
MySQL: 1000
Oracle: 1000
Microsoft SQL Server: 1000
PostgreSQL: 1000
DB2.: 1000
N/A
{{RDBMS-Name}}.batchEnable This specifies whether Update and Insert operations can be performed for batches of events or not. H2: true
MySQL: true
Oracle (versions 12.0 and less): false
Oracle (versions 12.1 and above): true
Microsoft SQL Server: true
PostgreSQL: true
DB2.: true
N/A
{{RDBMS-Name}}.transactionSupported This is used to specify whether or not the JDBC connection that is used supports JDBC transactions. H2: true
MySQL: true
Oracle: true
Microsoft SQL Server: true
PostgreSQL: true
DB2.: true
N/A

Examples EXAMPLE 1

@Store(type="rdbms", jdbc.url="jdbc:mysql://localhost:3306/das", username="root", password="root" , jdbc.driver.name="org.h2.Driver",field.length="symbol:100")
@PrimaryKey("symbol")@Index("volume")define table StockTable (symbol string, price float, volume long);

The above example creates an event table named StockTable on the DB if it does not already exist (with 3 attributes named symbol, price, and volume of the types types string, float and long respectively). The connection is made as specified by the parameters configured for the '@Store' annotation. The symbol attribute is considered a unique field, and a DB index is created for it.