# tDB2BulkExec

Executes the Insert action on the provided data and gains in performance during Insert operations to a DB2 database.

## tDB2BulkExec Standard properties

These properties are used to configure tDB2BulkExec running in the Standard Job framework.

The Standard tDB2BulkExec component belongs to the Databases family.

The component in this framework is available in all Talend products.

Information noteNote: This component is a specific version of a dynamic database connector. The properties related to database settings vary depending on your database type selection. For more information about dynamic database connectors, see [DB Generic components](https://help.qlik.com/talend/r/en-US/8.0/components/db-generic/db-generic-component).

## Basic settings

| Properties | Description |
| --- | --- |
| Database | Select the desired database type from the list and click<br>Apply. |
| Property type | <ul> <li> <p> <span>Either <span>Built-in</span> or										<span>Repository</span> </span>.</p> </li> <li> <p> <span>Built-in</span>: No property data stored								centrally.</p> </li> <li> <p> <span>Repository</span>: Select the repository								file in which the properties are stored. The fields that follow are								completed automatically using the data retrieved.</p> </li> </ul> |
| Use an existing connection | Select this check box and in the Component<br>List drop-down list, select the desired connection component to<br>reuse the connection details you already defined.<br><br>Information noteNote: When a Job contains the parent Job and the child Job, do the following if you<br>want to share an existing connection between the parent Job and the child Job (for example,<br>to share the connection created by the parent Job with the child Job).<br><br><ol> <li>In the parent level, register the database connection to be shared               in the <span>Basic settings</span> view of the               connection component which creates that very database connection. </li> <li>In the child level, use a dedicated connection component to read               that registered database connection. </li> </ol><br><br>For an example about how to share a database connection across Job levels,<br>see [Sharing a database connection](https://help.qlik.com/talend/r/en-US/7.3/studio-user-guide/sharing-database-connection). |
| Host | Database server IP address |
| Port | Listening port number of DB server. |
| Database | Name of the database |
| Table Schema | Name of the DB schema. |
| Username and<br>Password | DB user authentication data.<br><br>To enter the password, click the [...] button<br>next to the password field, enter the password in double quotes in the pop-up dialog box,<br>and click OK to save the settings. |
| Table | Name of the table to be written. Note that only one table can be<br>written at a time |
| Action on table | On the table defined, you can perform one of the following<br>operations:<br><br><br>None: No operation is carried<br>out.<br><br><br>Drop and create table: The table is<br>removed and created again.<br><br><br>Create table: The table does not<br>exist and gets created.<br><br><br>Create table if not exists: The<br>table is created if it does not exist.<br><br><br>Drop table if exists and create:<br>The table is removed if it already exists and created again.<br><br><br>Clear table: The table content is<br>deleted. |
| Schema and Edit<br>Schema | <ul> <li> <p>A schema is a row description. It defines the number of fields            (columns) to be processed and passed on to the next component. When you create a Spark            Job, avoid the reserved word <kbd>line</kbd> when naming the            fields.</p> </li> <li> <p> <span>Built-in</span>: You create the schema								and store it locally for this component only. For more information about a component schema in its <span>Basic settings</span> tab, see <a href="https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/basic-settings-tab" target="_blank">Basic settings tab</a>.</p> </li> <li> <p> <span>Repository</span>: You have already								created the schema and stored it in the Repository, hence can reuse								it. For more information about a component schema in its <span>Basic settings</span> tab, see <a href="https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/basic-settings-tab" target="_blank">Basic settings tab</a>.</p> </li> <li> <p>Click <span>Edit        schema</span> to make changes to the schema. If the current schema is of the <span>Repository</span> type, three options are available:</p> <ul> <li> <p> <span>View schema</span>: choose this                option to view the schema only.</p> </li> <li> <p> <span>Change to built-in property</span>:                choose this option to change the schema to <span>Built-in</span> for local changes.</p> </li> <li> <p> <span>Update repository connection</span>:                choose this option to change the schema stored in the repository and decide whether                to propagate the changes to all the Jobs upon completion.</p> <p>If you just want to                propagate the changes to the current Job, you can select <span>No</span> upon completion and choose this schema metadata                again in the <span>Repository Content</span>                window.</p> </li> </ul> </li> </ul> |
| Use Ingest Command | Select this check box to populate data into DB2 using the INGEST<br>command. For more information about the INGEST command, see http://www.ibm.com/developerworks/data/library/techarticle/dm-1304ingestcmd<br>and https://www-01.ibm.com/support/knowledgecenter/SSEPGG\_10.1.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0057198.html?cp=SSEPGG\_10.1.0%2F3-5-2-4-59. |
| Load From | Select the source of the data to be populated.<br><br><ul> <li> <p> <span>FILE</span>: loads data from a										file.</p> </li> <li> <p> <span>PIPE</span>: loads data from a										pipe.</p> </li> <li> <p> <span>FOLDER</span>: loads data from										multiple files in a folder.</p> </li> </ul><br><br>This list is available only when the Use<br>Ingest Command check box is selected. |
| Data File | Name of the file to be loaded.<br><br>Information noteNote: This file is located on the machine specified by the URI in the Host field so it should be on the same machine as the database server.<br><br>This field is not visible when<br>PIPE or FOLDER is selected<br>from the Load From drop-down list. |
| Data File/Named Pipe | Name of the file or the named pipe to load data from. This<br>component supports data file and named pipe when loading data into DB2 tables.<br>It loads data using the LOAD command by calling the DB2<br>system procedure SYSPROC.ADMIN\_CMD. For more information,<br>see [LOAD command using the ADMIN_CMD<br>procedure](https://www.ibm.com/docs/en/db2/10.5?topic=commands-load-using-admin-cmd#:~:text=LOAD%20command%20using%20the%20ADMIN_CMD%20procedure%20Efficiently%20loads,the%20data%20is%20loaded%20into%20the%20DB2%20table).<br><br>Information noteNote:<br><br><ul> <li>The file is located on the machine specified by the URI in the <span>Host</span> field so it should be on the same                           machine as the database server.</li> <li>Make sure the named pipe is a server-side named pipe. That is, it needs to                           be configured on the target server.  </li> </ul><br><br>This field is not visible when Use<br>Ingest Command is selected. |
| Pipe Name | Enter the name of the pipe.<br><br>This field is available only when PIPE is selected from the Load<br>From drop-down list. |
| Folder | Specify the path to the folder holding the files to be<br>loaded.<br><br>This field is available only when FOLDER is selected from the Load From drop-down list. |
| Action on Data | On the data of the table defined, you can perform one of the<br>following operations:<br><br><ul> <li> <p> <span>Insert</span>: Add new											records to the table. If duplicates are found, Job											stops.</p> </li> <li> <p> <span>Replace</span>: Add new											records to the table. If an old record in the table has											the same value as a new record for a PRIMARY KEY or a											UNIQUE index, the old record is deleted before the new											record is inserted.</p> </li> <li> <p> <span>Update</span>: Make changes											to existing records.</p> </li> <li> <p> <span>Delete</span>: Remove the											records that match the input data.</p> </li> <li> <p> <span>Merge</span>: Merge the											input data to the table.</p> </li> </ul><br><br><br>Delete and Merge are available only when the Use Ingest Command check box is<br>selected. |
| File Glob Pattern | Specify the global expression for the files to be loaded.<br><br>This field is available only when FOLDER is selected from the Load From drop-down list. |
| Where Clause | Enter the WHERE clause to filter the data to be processed.<br><br>This field is available only when update or delete is<br>selected from the Action on Data<br>drop-down list. |
| Custom Insert Values Clause | Select this check box and in the Insert<br>Values Clause field displayed enter the VALUES clause<br>for the insert operation.<br><br>This check box is available only when the Use Ingest Command check box is selected and<br>insert is selected from the<br>Action on Data drop-down<br>list. |
| Custom Update Set Clause | Select this check box and specify the SET clause for the update operation by completing the<br>Set Mapping table.<br><br>This check box is available only when the Use Ingest Command check box is selected and<br>update is selected from the<br>Action on Data drop-down<br>list. |
| Set Mapping | Complete this table to specify the SET clause for the update operation.<br><br><ul> <li> <p> <span>Column</span>: the name of the										column. By default, the fields in the <span>Column</span> column are same as what they are in										the schema.</p> </li> <li> <p> <span>Expression</span>: the										expression for the corresponding column.</p> </li> </ul><br><br>This table is available only when the Custom<br>Update Set Clause check box is selected. |
| Merge Clause | Specify the MERGE clause for the merge operation.<br><br>This table is available only when the Use<br>Ingest Command check box is selected and merge is selected from the Action on Data drop-down list. |
| Content Format | Select the format of the input file, either Delimited or Positional.<br><br>This list is available only when the Use<br>Ingest Command check box is selected. |
| Delimited By | Enter the character that separates the fields in the delimited<br>file.<br><br>This field is available only when Delimited is selected from the Content Format drop-down list. |
| Optionally Enclosed By | Enter the character that encloses the string in the delimited<br>file.<br><br>This field is available only when Delimited is selected from the Content Format drop-down list. |
| Fixed Length | Enter the length (in bytes) of the record in the positional<br>file.<br><br>This field is available only when Positional is selected from the Content Format drop-down list. |
| Mapping | Complete this table to specify the mapping relationship between<br>the source column and the DB2 table column.<br><br><ul> <li> <p> <span>Column</span>: the name of the										column. By default, the fields in the <span>Column</span> column are same as what they are in										the schema.</p> </li> <li> <p> <span>Is Table Column</span>: select										the check box if the corresponding column is a table										column.</p> </li> <li> <p> <span>Start Position</span>: the										starting position of the corresponding column.</p> </li> <li> <p> <span>End Position</span>: the ending										position of the corresponding column.</p> <p>The <span>Start Position</span> and											<span>End Position</span> columns										are available only when <span>Positional</span> is selected from the <span>Content Format</span> drop-down										list.</p> </li> </ul><br><br>This table is available only when the Use<br>Ingest Command check box is selected. |
| Script Generated Folder | Specify the directory under which the script file will be<br>created.<br><br>This field is available only when the Use<br>Ingest Command check box is selected. |

## Advanced settings

| Properties | Description |
| --- | --- |
| Additional JDBC parameters | Specify additional connection properties for the DB connection you<br>are creating.<br><br>Information noteNote:<br><br>You can set the encoding parameters through this field. |
| Field terminated by | Character, string or regular expression to separate fields. |
| Date Format | Use this field to define the way months and days are<br>ordered. |
| Time Format | Use this field to define the way hours, minutes and seconds are<br>ordered. |
| Timestamp Format | Use this field to define the way date and time are ordered. |
| Remove load pending | When the box is ticked, tables blocked in "pending" status<br>following a bulk load are de-blocked. |
| Load options | Click + to add data loading<br>options:<br><br><br>Parameter: select a loading<br>parameter from the list.<br><br><br>Value: enter a value for the<br>parameter selected. |
| tStat<br>Catcher Statistics | Select this check box to collect log data at the component<br>level. |

## Global Variables

| Variables | Description |
| --- | --- |
| Global Variables | NB\_LINE:<br>the number of rows processed. This is an After variable and it returns an integer.<br><br><br>NB\_LINE\_UPDATED: the number of rows updated.<br>This is an After variable and it returns an integer.<br><br><br>NB\_LINE\_INSERTED: the number of<br>rows inserted. This is an After variable and it returns an integer.<br><br><br>NB\_LINE\_DELETED: the<br>number of rows deleted. This is an After variable and it returns an integer.<br><br><br>QUERY: the query statement processed. This<br>is an After variable and it returns a string.<br><br><br>ERROR\_MESSAGE: the error message generated by the<br>component when an error occurs. This is an After variable and it returns a string. This<br>variable functions only if the Die on error checkbox is<br>cleared, if the component has this checkbox.<br><br>A Flow variable functions during the execution of a component<br>while an After variable functions after the execution of the component.<br><br>To fill up a field or expression with a variable, press Ctrl+Space to access the variable list and choose the variable to use from<br>it.<br><br>For more information about variables, see [Using contexts and variables](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/contexts-and-variables). |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | This dedicated component offers performance and flexibility of<br>DB2 query handling. |
| Dynamic settings | Click the [+] button to add a row in the table<br>and fill the Code field with a context<br>variable to choose your database connection dynamically from multiple<br>connections planned in your Job. This feature is useful when you need to<br>access database tables having the same data structure but in different<br>databases, especially when you are working in an environment where you<br>cannot change your Job settings, for example, when your Job has to be<br>deployed and executed independent of Talend Studio.<br><br>The Dynamic settings table is<br>available only when the Use an existing<br>connection check box is selected in the Basic settings view. Once a dynamic parameter is<br>defined, the Component List box in the<br>Basic settings view becomes unusable.<br><br>For examples on using dynamic parameters, see [Reading data from databases through<br>context-based dynamic connections](https://help.qlik.com/talend/r/en-US/8.0/components/defining-context-groups/reading-data-from-databases-through-context-based-dynamic-connections) and [Reading data from different MySQL databases<br>using dynamically loaded connection parameters](https://help.qlik.com/talend/r/en-US/8.0/components/context/reading-data-from-different-mysql-databases-using-dynamically-loaded-connection-parameters). For more information on<br>Dynamic settings and context variables, see<br>[Dynamic schema](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/dynamic-schema) and [Creating a context group and define context<br>variables in it](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/creating-context-group-and-define-context-variables-in-it). |