# tMSSqlConnection

Opens a connection to the specified database that can then be reused in the subsequent subJob or subJobs.

tMSSqlConnection opens a connection to a Microsoft SQL Server database or a Microsoft Azure SQL database.

## tMSSqlConnection Standard properties

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

The Standard tMSSqlConnection component belongs to the Databases and the ELT families.

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. |
| Property type | Either Built-in or<br>Repository.<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> |
| 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 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 this field<br>in the format of {host\_name}\{instance\_name}. In this<br>case, you can 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. |
| 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. |
| Schema | Enter the name of the database schema. |
| Database | Enter the name of the database. |
| 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. |
| 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. |
| Use or register a shared DB Connection | Select this checkbox to share<br>your database connection or fetch a database connection shared by a parent or<br>child Job, and in the Shared DB connection name field<br>displayed, enter the name for the shared database connection. This allows you<br>to share one single database connection (except the database schema setting)<br>among several database connection components from different Job levels that can<br>be either parent or child.<br><br>This option is<br>incompatible with the Use dynamic Job and Use an<br>independent process to run subJob options of the<br>tRunJob component. Using a shared connection together with a<br>tRunJob component with either of these two options enabled<br>will cause your Job to fail.<br><br>This checkbox is not available when the Specify a data source<br>alias checkbox is selected. |
| Specify a data source alias | Select this checkbox and specify the alias of a data source created on the *Talend Runtime* side to use the shared connection pool defined in the data source configuration. This<br>option works only when you deploy and run your Job in *Talend Runtime*.<br><br>This checkbox is not visible when the Use or register a<br>shared DB Connection checkbox is selected. |
| Data source alias | Enter the alias of the data source created on the *Talend Runtime* side.<br><br>This field is available only when the Specify a data<br>source alias checkbox is selected. |

## Advanced settings

| Properties | Description |
| --- | --- |
| 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). |
| Auto Commit | Select this checkbox to commit any changes to the database automatically<br>upon the transaction.<br><br>With this checkbox selected, you cannot use the corresponding commit<br>component to commit changes to the database; likewise, when using the<br>corresponding commit component, this checkbox has to be cleared. By default, the<br>auto commit function is disabled and changes must be committed explicitly using<br>the corresponding commit component.<br><br>Note that the auto commit function commits each SQL statement as a<br>single transaction immediately after the statement is executed while the<br>commit component does not commit only until all of the statements are<br>executed. For this reason, if you need more room to manage your transactions<br>in a Job, it is recommended to use the commit component. |
| Share identity insert in multi table | Select this checkbox to share IDENTITY\_INSERT among multiple<br>Microsoft SQL tables that accept data through the same database connection.<br><br>This option prevents errors caused by setting IENTITY\_INSERT to ON (or OFF) repeatedly<br>when writing Microsoft SQL tables through a database connection. It is<br>necessary to check this option when the component is used along with<br>multiple tMSSqlOutput components<br>with their Turn on Identity<br>insert options checked in the Basic settings tab.<br><br>Note that checking this option may decrease the<br>execution performance. |
| tStatCatcher Statistics | Select this checkbox to gather the Job processing metadata at a Job level as<br>well as at each component level. |

## Usage

| Usage guidance | Description |
| --- | --- |
| Usage rules | This component is more commonly used with other tMSSql\* components,<br>especially with the tMSSqlCommit and<br>tMSSqlRollback components.<br><br>Information noteImportant: Microsoft SQL Server/JDBC encryption requirements<br><br>Starting<br>with recent versions of the Microsoft SQL Server JDBC driver, TLS encryption<br>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). |
| Limitation | Due to license incompatibility, one or more JARs required to use this component<br>are not provided. You can install the missing JARs for this particular component by<br>clicking the Install button on the Component tab view. You can also find out and add all missing<br>JARs easily on the Modules tab in the Integration perspective of Talend Studio. For<br>details, see [Installing external modules](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/installing-external-modules). |

**Related concepts**

* [Inserting data into a database table and extracting useful information from it](https://help.qlik.com/talend/en-US/components/8.0/mssql/tmssqlinput-tmssqloutput-tlogrow-inserting-data-into-database-table-and-extracting-useful-information-from-it-standard-component-the)