Creating a MySQL data source in Talend Runtime Container
To be able to retrieve data from a MySQL database table and displays the data on
the console, you must have created a MySQL data source in Talend Runtime
Container.
the console, you must have created a MySQL data source in Talend Runtime
Container.
You must have properly installed Talend Runtime in the machine
in which you want to execute your Job. For further information, search for
installing Talend
Runtime on Talend Help Center (https://help.talend.com).
-
Install the MySQL JDBC driver by running the following
bundle:install command in Talend Runtime
Container:1karaf@trun()> bundle:install mvn:mysql/mysql-connector-java/5.1.18 -
Install the database connection pool by running the following
bundle:install command in Talend Runtime Container:1karaf@trun()> bundle:install -s mvn:commons-dbcp/commons-dbcp/1.4 -
Copy the data source configuration file
datasource-mysql.xml under the folder
<TalendRuntimePath>/add-ons/datasources/dataservice
to the folder <TalendRuntimePath>/container/deploy
and then in the file update the username and password property values required
to connect to your database.1234567891011121314151617181920212223<?xml version="1.0" encoding="UTF-8"?><blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"default-activation="lazy"><bean id="mysqlDataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"><property name="url" value="jdbc:mysql://localhost:3306/test"/><property name="user" value="root"/><property name="password" value="talend"/></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></blueprint>Note: The property osgi.jndi.service.name in the data
source configuration file defines the data source alias, jdbc/sample, in this example. The alias will be used in the database
component to connect to the database defined in the data source
configuration file when the Job is deployed in Talend Runtime.For more information about how to use the data source in
Talend Runtime Container, see Talend ESB Container Administration Guide and
Talend ESB Studio User Guide.
Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Login
0 Comments