SQLBatchJob batch
Important
The SQLBatchJob batch must be used only if it is suggested by Akuiteo.
The SQLBatchJob batch is used to modify or query the Akuiteo database, thanks to SQL requests or a database-stored procedures.
To use the SQLBatchJob batch, the BATCH_SQL_ACTIF management rule must be enabled.
When creating the batch, select SQLBatchJob in the Batch template drop-down list.
When the batch is started, an SQL request or a stored procedure is run:
- If you want the batch to run an SQL request, the
REQUESTparameter must be specified with an SQL request and theIS_STORED_PROCparameter must be False. - If you want the batch to run a database-stored procedure, the
REQUESTparameter must be specified with the name of a stored procedure and theIS_STORED_PROCparameter must be True.
The request or the stored procedure can be:
- of the INSERT, UPDATE or DELETE type in order to modify the Akuiteo database.
- of the SELECT type in order to query the database and save the result in an output file. In that case, the
GENERATE_OUTPUTparameter must be True and the other related parameters must be specified if needed (see Output file).
If needed, additional parameters can be specified in the PARAMETERS parameter in order to apply them to the request or stored procedure.
Output file
When the request or stored procedure is of the SELECT type and the GENERATE_OUTPUT parameter is True, the batch saves the result in an output file. This file is saved:
- in the directory in the local Akuiteo server, specified in the
CHEMINparameter of the batch. - in the desired FTP directory if the related parameters are specified (
FTP_CHEMIN,FTP_MODE,FTP_PASSWORD,FTP_PORT,FTP_SERVEUR,FTP_USER,SFTP_SSH_KEYSTOREandSFTP_SSH_KEYSTORE_PASSWORD).
The other parameters related to the output file are CARRIAGE_RETURN, ENCODING, EXTENSION, FILENAME, SEPARATOR, SHOW_HEADERS and TIMESTAMP (see Setting up the batch).
Note
The output file generated will be empty if the request or stored procedure is not of the SELECT type.
The parameters in the following table correspond only to the parameters specific to the SQLBatchJob batch.
Reference
To view the parameters common among batches, refer to Setting up the common parameters.
| Code | Description | Type | Required |
|---|---|---|---|
|
|
Enables the batch to always send log emails even if no error occurred. Log emails will be sent to the email address specified in the |
Boolean |
Yes |
CARRIAGE_RETURN
|
Note This parameter is used only if the Format of the character corresponding to carriage returns in the output file:
|
List of values Ex: Windows () |
No |
CHEMIN
|
Note This parameter is required if the Path to access the directory on the local Akuiteo server in which the output file will be saved. |
String Ex: C:\akuiteo\docs\SqlResults |
No |
ENCODING
|
Note This parameter is used only if the Output file encoding. If the parameter is not specified, the default encoding is UTF-8. |
String Ex: ISO-8859-1 |
No |
EXTENSION
|
Note This parameter is used only if the Output file extension |
String Ex: txt |
No |
FILENAME
|
Note This parameter is used only if the Output file name. |
String Ex: SqlResult |
No |
FTP_CHEMIN
|
Note This parameter is used only if the Path to access the directory on the FTP or SFTP server in which the output file will be dropped by the batch. |
String Ex: docs\SqlResults |
No |
FTP_MODE
|
Note This parameter is used only if the Method to connect to the FTP or SFTP server. If SFTP is specified, the Important Only the FTP or SFTP connection methods can be used. |
String Ex: FTP |
No |
FTP_PASSWORD
|
Note This parameter is used only if the Password to connect to the FTP or SFTP server. This password must be linked to the |
String Ex: aHFG45*F |
No |
FTP_PORT
|
Note This parameter is used only if the FTP or SFTP server port. |
Number Ex: 21 |
No |
FTP_SERVEUR
|
Note This parameter is used only if the FTP or SFTP server to which invoices will be dropped by the batch. |
String Ex: ftp.akuiteo.fr |
No |
FTP_USER
|
Note This parameter is used only if the Login to connect to the FTP or SFTP server. |
String Ex: TECH |
No |
GENERATE_OUTPUT
|
If the parameter of the batch is True, the result of the SELECT request or stored procedure is saved in an output file. The request or stored procedure must be of the SELECT type. Otherwise, the output file will be empty. If the parameter is False, no output fill will be saved. |
Boolean | Yes |
IS_STORED_PROC
|
If the parameter is True, the batch will run a procedure stored in the database. The value to specify in the If the parameter is False, the batch will run an SQL request. The value to specify in the |
Boolean | Yes |
IS_STORED_PROC_WITH_UPDATE
|
Note This parameter is used only if the The parameter must be True if the stored procedure is of the INSERT, UPDATE or DELETE type. The parameter must be False if the stored procedure is of the SELECT type. The batch will encounter an error during its execution if the wrong option is selected for this parameter. |
Boolean | No |
PARAMETERS
|
Values of the parameters of the request or the stored procedure. In the SQL request or stored procedure, parameter keys can be specified in the [parameterName] format. In the To specify multiple parameters, use the | separator (ex: key1=value1|key2=value2|key3=value3). Example The SQL request contains the following line which is used to filter projects starting with the value provided in the
In the The SQL request will return projects whose code starts with A123. |
String | No |
REQUEST
|
SQL request or stored procedure to run. If the Example
If the Example The stored procedure is named procedure and the arguments to use are param1 and param2. The value to specify in Important Do not insert a semicolon ; at the end of the expression. |
SQL request |
Yes |
SEPARATOR
|
Note This parameter is used only if the Column separator in the output file |
String Ex: ; |
No |
SFTP_SSH_KEYSTORE
|
Important This parameter is required if SFTP is specified for Path to access the Keystore file that is protected by a password and that contains keys and certificates. |
String Ex: keystore |
No |
SFTP_SSH_KEYSTORE_PASSWORD
|
Important This parameter is required if SFTP is specified for Password to access the Keystore file. |
String Ex: aHFG45*F |
No |
SHOW_HEADERS
|
Note This parameter is used only if the If the parameter is True, column headers are included in the output file. |
Boolean | No |
TIMESTAMP
|
Note This parameter is used only if the Timestamp added to the output file name, beween the The parameter must be specified with the Java syntax of the SimpleDateFormat object. Refer to Oracle's documentation for more information. If the parameter is empty, the timestamp will not be included in the output file name. |
String Ex: yyyy.MM.dd |
No |