# tMSSqlOutputBulkExec

Gains in performance during Insert operations to a Microsoft SQL Server database.

The tMSSqlOutputBulk and tMSSqlBulkExec components are used together in a two step process. In the first step, an output file is generated. In the second step, this file is used in the INSERT operation used to feed a database. These two steps are fused together in the tMSSqlOutputBulkExec component.

## tMSSqlOutputBulkExec Standard properties

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

The Standard tMSSqlOutputBulkExec 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).

Information noteNote: When building a Job as an OSGI Bundle for ESB, MS SQL Server drivers jtds and mssql-jdbc used by the SQL Server components are not included in the build artifact. To run the artifact in Talend Runtime, you need to deploy the drivers manually by copying the drivers to the &lt;TalendRuntimePath&gt;/lib folder and restart Talend Runtime.

## Basic settings

| Properties | Description |
| --- | --- |
| Database | Select the desired database type from the list and click<br>Apply. |
| Action | Select the action to be carried out<br><br><br>Bulk insert<br>Bulk update |
| Property type | Either Built-in or<br>Repository<br>.<br><br><ul> <li> <span>Built-in</span>: No property data stored                        centrally.</li> <li> <span>Repository</span>: Select the repository                        file in which the properties are stored. The fields that follow are                        completed automatically using the data retrieved.</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). |
| JDBC Provider | Select the provider of the JDBC driver to be used, either Microsoft (the default, recommended) or Open<br>source JTDS.<br><br>When Microsoft is selected, you need to download the<br>Microsoft JDBC Driver for SQL Server on [Microsoft Download<br>Center](https://www.microsoft.com/en-us/download/details.aspx?id=11774), unpack the downloaded zip file, choose a jar in the<br>unzipped folder based on your JRE version, rename the jar to *mssql-jdbc.jar* and install it manually. For more<br>information about choosing the jar, see the System Requirements<br>information on [Microsoft Download<br>Center](https://www.microsoft.com/en-us/download/details.aspx?id=11774).<br><br>Note that OSGi builds will not<br>include any open source jTDS JDBC driver. If you need to build your Job<br>containing this component as an OSGi bundle, use the official Microsoft<br>JDBC driver; otherwise, this component will work only with Datasource<br>with the jTDS JDBC driver properly installed in<br>Talend Runtime. |
| Host | Enter the IP address or the hostname of the database server or the<br>Azure Synapse Analytics to be used.<br><br>If the SQL<br>Server Browser service is running on the machine where the server<br>resides, you can connect to a named instance through a TCP dynamic port by<br>providing the host name and the instance name in this field in the format of<br>{host\_name}\{instance\_name}. In this case, you can<br>leave the Port field empty. See [SQL Server Browser service](https://docs.microsoft.com/en-us/sql/tools/configuration-manager/sql-server-browser-service?view=sql-server-ver16) for related<br>information.<br><br>Currently, only *localhost*, *127.0.0.1* or the exact IP address of<br>the local machine is allowed for proper functioning. In other words, the<br>database server must be installed on the same machine where Talend Studio is installed or where the Job using tMSSqlOutputBulkExec is deployed. |
| Port | Enter the listening port number of the database server or the Azure Synapse<br>Analytics to be used.<br><br>If the SQL Server Browser service is running on the<br>machine where the server resides, you can connect to a named instance through a<br>TCP dynamic port by providing the host name and the instance name in the<br>Host field and leave this field empty. See [SQL Server Browser service](https://docs.microsoft.com/en-us/sql/tools/configuration-manager/sql-server-browser-service?view=sql-server-ver16) for related<br>information. |
| DB name | Enter the name of the database |
| Schema | Enter the name of the database schema. |
| Username and<br>Password | Enter the authentication data.<br><br>To enter the password, click the<br>[...] button next to the<br>Password field, enter the password in double<br>quotes in the pop-up dialog box, and then click<br>OK.<br><br>You can use<br>Type 2 integrated authentication on<br>Windows by adding<br>integratedSecurity=true in the<br>Additional JDBC Parameters field and leave<br>these two fields empty. See section *Connecting with integrated<br>authentication On Windows* at [Building the connection URL](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?redirectedfrom=MSDN) for related<br>information. |
| Table | Name of the table to be written.<br><br>Note that only one table can be written<br>at a time and that the table must exist for the insert operation to<br>succeed. |
| Action on table | On the table defined, you can perform one of the following operations:<br><br><ul> <li> <span>None</span>: No operation is carried                        out.</li> <li> <span>Drop and create a table</span>: The table is                        removed and created again.</li> <li> <span>Create a table</span>: The table does not                        exist and gets created.</li> <li> <span>Create a table if not exists</span>: The                        table is created if it does not exist.</li> <li> <span>Truncate table</span>: The table content is                        deleted. You do not have the possibility to rollback the operation.</li> <li> <span>Clear a table</span>: The table content is                        deleted. You have the possibility to rollback the operation.</li> </ul> |
| Schema and Edit schema | A schema is a row description. It defines the number of fields<br>(columns) to be processed and passed on to the next component. When you create a Spark<br>Job, avoid the reserved word line when naming the<br>fields.<br><br><br>Built-In: You create and store the schema locally for this component<br>only.<br><br><br>Repository: You have already created the schema and stored it in the<br>Repository. You can reuse it in various projects and Job designs.<br><br>When the schema to be reused has default values that are<br>integers or functions, ensure that these default values are not enclosed within<br>quotation marks. If they are, you must remove the quotation marks manually.<br><br>For more information, see [Retrieving table schemas](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/retrieving-table-schemas?tocId=_C1~eFOlN~GM_JR2qkBYZg).<br><br>Click Edit<br>schema to make changes to the schema. If the current schema is of the Repository type, three options are available:<br><br><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> |
| File Name | Enter the name of the file to be generated and loaded.<br><br>Information noteNote: This file can be on the same machine as the database server resides or on<br>another machine. If the file is on the same machine as the database server<br>resides, fill the path to the file in the form prompted in the field; if the<br>file is on another machine, fill the universal naming convention (UNC) name<br>(that is, \\{Servername}\{Sharename}\{Path}\{Filename})<br>of the file in this field. In the second case, you need to have the permission<br>to read and write the file. See [Bulk importing to SQL Server from a remote<br>data file](https://docs.microsoft.com/en-us/sql/relational-databases/import-export/import-bulk-data-by-using-bulk-insert-or-openrowset-bulk-sql-server?view=sql-server-ver16#bulk-importing-to-sql-server-from-a-remote-data-file) for related information. |
| Append | Select this checkbox to add the new rows at the end of the records |

## Advanced settings

| Properties | Description |
| --- | --- |
| Additional JDBC parameters | Specify additional connection properties for the database<br>connection you are creating. The properties are separated by semicolon and<br>each property is a key-value pair. For example, *encrypt=true;trustServerCertificate=false;*<br>*hostNameInCertificate=\*.database.windows.net;loginTimeout=30;* for<br>Azure SQL database connection.<br><br>This field is not available if the Use an existing<br>connection check box is selected. |
| Authenticate using Azure Active<br>Directory | When selected, this option allows you to pick the authentication mode to use<br>from the Azure Active Directory authentication mode<br>dropdown list:<br><br><ul> <li><span>Service principal (client secret)</span>: use the service                        principal credentials (client ID and client secret) to authenticate.</li> <li><span>User password</span>: use the Azure Active Directory user                        credentials (username and password) to authenticate.</li> </ul><br><br>Read the Usage section of this document for<br>information about Microsoft SQL Server/JDBC encryption requirements.<br><br>This option is only available when<br>Microsoft is selected from the JDBC<br>Provider dropdown list in the Basic<br>settings view. |
| Enable always encrypted (Column encryption) | Select this option to use the Microsoft [Always encrypted](https://learn.microsoft.com/en-us/sql/relational-databases/security/encryption/always-encrypted-database-engine?view=sql-server-ver15) feature to encrypt and protect your<br>data. To use this option, you need to have previously stored your secrets with<br>[Azure Key Vault](https://learn.microsoft.com/en-us/azure/key-vault/general/basic-concepts):<br><br><ul> <li> <span>Application Client ID</span>: Enter the client ID for the                        registered application. This information can be found in the details of your                        app under <span><span>Azure Active Directory</span><abbr> &gt; </abbr><span>App registrations</span><abbr> &gt; </abbr><span>Essentials</span></span>.</li> <li> <span>Application Client Secret</span>: Enter the client password                        for the registered application. This information can be found in the details                        of your app under <span><span>Azure Active Directory</span><abbr> &gt; </abbr><span>App registrations</span><abbr> &gt; </abbr><span>Certificates and secrets</span></span>.</li> </ul><br><br>Some limitations regarding query operations and statements apply to this<br>feature. For the exhaustive list of limitations, see the [Microsoft SQL Server<br>documentation](https://learn.microsoft.com/en-us/sql/relational-databases/security/encryption/always-encrypted-database-engine?view=sql-server-ver15#limitations). |
| Field separator | Character, string, or regular expression to separate fields. |
| Row separator | String (ex: "\n"on Unix) to distinguish rows. |
| First row | Type in the number of the row where the action should start. |
| Include header | Select this checkbox to include the column header. |
| Code page | OEM code pages used to map a specific<br>set of characters to numerical code point values. |
| Data file type | Select the type of data being handled. |
| Encoding | Select the encoding from the list or select Custom and define it manually.<br>This field is compulsory for DB data handling. |
| tStatCatcher statistics | Select this checkbox to collect log data at the component level. |

## Usage

| Usage guidance | Description |
| --- | --- |
| Usage rules | This component is mainly used when no particular transformation is required<br>on the data to be loaded onto the database.<br><br>Information noteImportant: Microsoft SQL<br>Server/JDBC encryption requirements<br><br>Starting with recent versions of the<br>Microsoft SQL Server JDBC driver, TLS encryption is enabled by default<br>(encrypt=true;trustServerCertificate=false). This<br>enhances security, but if your SQL Server does not support encrypted<br>connections or does not require clients to use TLS, you must set<br>encrypt=false in the JDBC parameters of this component<br>to connect successfully.<br><br><ul> <li> <p>For production or cloud environments using certificates signed by a                              trusted authority (e.g., Azure, AWS), no changes are needed, the                              default settings will work. </p> </li> <li> <p>For servers using self-signed certificates, use                                 <span>encrypt=true;trustServerCertificate=true</span> or                              specify the trust store details                                 (<span>encrypt=true;trustStore=&lt;your_trust_store&gt;;trustStorePassword=&lt;your_trust_store_password&gt;</span>).                           </p> </li> <li> <p>For non-secure development or test servers, set                                 <span>encrypt=false</span> in the additional JDBC parameters.                           </p> </li> </ul><br><br>For more information on how to use connections with encryption<br>properties, see [Microsoft SQL JDBC documentation](https://learn.microsoft.com/en-us/sql/connect/jdbc/connecting-with-ssl-encryption?view=sql-server-ver17). |
| 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). |
| Limitation | The database server must be installed on the same machine where Talend Studio<br>is installed or where the Job using tMSSqlOutputBulkExec is deployed, so that the component functions<br>properly. |