# Configuring datasource in Talend Runtime

To use datasource in Talend Runtime, you need to install the MySQL driver in to a container and set the datasource configuration file.

To do so, start a Talend Runtime container first. For more information about how to install Talend ESB Runtime and how to start Talend Runtime container, see [Installing Talend Runtime](https://help.qlik.com/talend/r/en-US/8.0/installation-guide-linux/install-runtime) and [Running Talend ESB Container](https://help.qlik.com/talend/r/en-US/8.0/installation-guide-linux/running-esb-container).

## Installing MySQL driver into a container

To use the MySQL database, its corresponding JDBC driver need to be explicitly installed into the container before installing the datasource. You can install the MySQL driver from a public Maven repository.

### Procedure

In a Talend Runtime container, run the following command (change the database version numbers if applicable):

MySQL 5.x

```
bundle:install mvn:mysql/mysql-connector-java/5.1.18
```

Information noteImportant: Support for MySQL version 5 has been removed from Talend 8.0 R2026-04 onwards.

MySQL 8.x

```
bundle:install mvn:mysql/mysql-connector-java/8.0.27
```

For more information on how to install the H2, Oracle, DB2, SQL Server, and PostgreSQL JDBC drivers into a container, see [DataSource Installation](https://help.qlik.com/talend/r/en-US/8.0/esb-infra-services-configuration-guide/datasource-installation).

## Setting the datasource configuration file

### Procedure

1. Set the database connection details in the MySQL datasource configuration file named datasource-mysql.xml in the &lt;TalendRuntimePath&gt;/add-ons/datasources/dataservice folder.

   For MySQL 5.x:
   ```
   <bean id="mysqlDataSource" class="com.mysql.jdbc.jdbc2.optional.
   MysqlConnectionPoolDataSource">
       <property name="url" value="jdbc:mysql://localhost:3306/root"/>
       <property name="user" value="root"/>
       <property name="password" value=""/>
   </bean>

   <bean id="dataSource" class="org.apache.commons.dbcp.datasources.
   SharedPoolDataSource" destroy-method="close">
       <property name="connectionPoolDataSource" ref="mysqlDataSource"/>
       <property name="maxActive" value="20"/>
       <property name="maxIdle" value="5"/>
       <property name="maxWait" value="-1"/>
   </bean>

   <service ref="dataSource" interface="javax.sql.DataSource">
       <service-properties>
            <entry key="osgi.jndi.service.name" value="jdbc/sample"/>
       </service-properties>
   </service>
   ```

   Information noteImportant: Support for MySQL version 5 has been removed from Talend 8.0 R2026-04 onwards.

   For MySQL 8.x:
   ```
   <bean id="mysqlDataSource" class="com.mysql.cj.jdbc.MysqlConnectionPoolDataSource">
       <property name="url" value="jdbc:mysql://localhost:3306/root"/>
       <property name="user" value="root"/>
       <property name="password" value=""/>
   </bean>

   <bean id="dataSource" class="org.apache.commons.dbcp.datasources.
   SharedPoolDataSource" destroy-method="close">
       <property name="connectionPoolDataSource" ref="mysqlDataSource"/>
       <property name="maxActive" value="20"/>
       <property name="maxIdle" value="5"/>
       <property name="maxWait" value="-1"/>
   </bean>

   <service ref="dataSource" interface="javax.sql.DataSource">
       <service-properties>
            <entry key="osgi.jndi.service.name" value="jdbc/sample"/>
       </service-properties>
   </service>
   ```
2. Copy the configuration file to the deploy folder in the Talend Runtime container directory. The datasource alias jdbc/sample will be used in the MySQL database components when configuring the Job in Talend Studio. You can also change it as needed.