The sql is used for SQL communications. Connector settings are divided into three blocks:
General connector settings
General connector settings are located on the Main settings tab:
If an individual connection (see below) has its own defined query and/or query interval, this connection will use the values specifically defined for its own query and/or query interval.
Settings of a specific SQL connection
General connector settings are located on the Main settings tab. You can create multiple connections in one connector by using the Add connection button to add new ones. You can delete connections by using the button.
Connection settings:
When creating connections, strings containing account credentials with special characters may be incorrectly processed. If a connection is not being created even though you are sure that your settings are correct, enter the special characters in percent encoding.
Available formats for server addresses: hostname:port, IPv4:port, IPv6:port.
If required, a secret can be created in the connector creation window using the button. The selected secret can be changed by clicking on the button.
One SQL connection is defined by using the URL, Identity column, and Identity seed parameters. The last line where data was read from the SQL table is saved in the KUMA collector that generated the query sent to the SQL database. This allows the program to start from the last read line when reading data from the SQL table. The ID of the last read line does not change when a different URL or query is indicated in the connector. To change the starting line where data acquisition from the SQL table will begin, you must change the value of the Identity seed and/or Identity column fields.
Advanced settings of a connector
Additional connector settings are located on the Advanced settings tab:
UTF-8
.KUMA can process SQL responses in UTF-8 character encoding. Either ensure that the SQL server sends messages in UTF-8 or use the Character encoding drop-down list in the Connector settings to convert incoming messages to UTF-8.
Supported SQL types and their specific usage features
The UNION operator is not supported by the SQL Connector resources.
The following SQL types are supported:
Example URLs:
sqlserver://{user}:{password}@{server:port}/{instance_name}?database={database}
– (recommended option)sqlserver://{user}:{password}@{server}?database={database}
The characters @p1
are used as a placeholder in the SQL query.
If you need to connect using domain account credentials, specify the account name in <domain>%5C<user>
format. For example: sqlserver://domain%5Cuser:password@ksc.example.com:1433/SQLEXPRESS?database=KAV
.
Example URL: mysql://{user}:{password}@tcp({server}:{port})/{database}
The character ?
is used as a placeholder in the SQL query.
Example URL: postgres://{user}:{password}@{server}/{database}?sslmode=disable
The characters $1
are used as a placeholder in the SQL query.
Example URL: postgres://{user}:{password}@{server}:{port}/{database}?sslmode=disable
The characters $1
are used as a placeholder in the SQL query.
Example URL: sqlite3://file:{file_path}
A question mark (?
) is used as a placeholder in the SQL query.
Example URL: oracle://{user}/{password}@{server}:{port}/{service_name}
Easy Connect syntax is used. The characters :val
are used as a placeholder in the SQL query.
When querying the Oracle DB, if the initial value of the ID is in datetime format, the Oracle to_timestamp_tz
function should be used to add the date conversion to the SQL query. For example, select * from connections where login_time > to_timestamp_tz(:val, 'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM')
. In this example, Connections
is the Oracle DB table and the :val
variable is taken from the Identity seed field, therefore it must be indicated in a format with the timezone (for example, 2021-01-01T00:10:00+03:00
).
To access the Oracle DB, the libaio1 package must be installed.
Example URL: firebirdsql://{user}:{password}@{server}:{port}/{database}
A question mark (?
) is used as a placeholder in the SQL query.
A sequential request for database information is supported in SQL queries. For example, if you type select * from <name of data table> where id > <placeholder>
in the Query field, the Identity seed field value will be used as the placeholder value the first time you query the table. In addition, the service that utilizes the SQL connector saves the ID of the last read entry, and the ID of this entry will be used as the placeholder value in the next query to the database.