Setting the datasource configuration file - 7.3

Data Service and Routing Examples

Version
7.3
Language
English
Product
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development > Designing Routes
Design and Development > Designing Services
Last publication date
2023-12-08

Procedure

  1. Set the database connection details in the MySQL datasource configuration file named datasource-mysql.xml in the <TalendRuntimePath>/add-ons/datasources/dataservice folder.
    <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>
  2. Copy the configuration file to the deploy folder within the Talend Runtime container directory. The datasource alias jdbc/sample will be used in the MySQL database components when configuring the Job in the Studio. You can also change it as needed.