Help Center > > Developer Guide> Distributed Transaction Management Development Guide> Connecting to DTM in TCC Mode> Connecting ServiceComb to DTM> Configuring Data Sources

Configuring Data Sources

Updated at: Sep 17, 2021 GMT+08:00
The DTMDataSource data source is added to the service database to protect the service data.
@Bean(name = "dataSource")
public DataSource dtmDataSource() {
    //Use the DTM data source to encapsulate the service data source.
    return new DTMDataSource(datasource);
}
Add the DTMDataSource data source to the service of Bank A as follows:
// com.huawei.banka.config.DataSourceConfig.java;
@Bean(name = "BankADataSource")
@ConfigurationProperties(prefix = "spring.datasource.banka")
public DataSource bankADataSource() {
    return new DTMDataSource(datasource);
}
Add the DTMDataSource data source to the service of Bank B as follows:
// com.huawei.bankb.config.DataSourceConfig.java
@Bean(name = "BankBDataSource")
@ConfigurationProperties(prefix = "spring.datasource.bankb")
public DataSource bankBDataSource() {
    return new DTMDataSource(datasource);

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel