use of com.alibaba.nacos.config.server.service.datasource.DataSourceService in project nacos by alibaba.
the class StandaloneDatabaseOperateImpl method init.
@PostConstruct
protected void init() {
DataSourceService dataSourceService = DynamicDataSource.getInstance().getDataSource();
jdbcTemplate = dataSourceService.getJdbcTemplate();
transactionTemplate = dataSourceService.getTransactionTemplate();
LogUtil.DEFAULT_LOG.info("use StandaloneDatabaseOperateImpl");
}
use of com.alibaba.nacos.config.server.service.datasource.DataSourceService in project nacos by alibaba.
the class DerbySnapshotOperation method doDerbyBackup.
private void doDerbyBackup(String backupDirectory) throws Exception {
DataSourceService sourceService = DynamicDataSource.getInstance().getDataSource();
DataSource dataSource = sourceService.getJdbcTemplate().getDataSource();
try (Connection holder = Objects.requireNonNull(dataSource, "dataSource").getConnection()) {
CallableStatement cs = holder.prepareCall(backupSql);
cs.setString(1, backupDirectory);
cs.execute();
}
}
use of com.alibaba.nacos.config.server.service.datasource.DataSourceService in project nacos by alibaba.
the class DerbySnapshotOperation method doDerbyRestoreFromBackup.
private void doDerbyRestoreFromBackup(Callable<Void> callable) throws Exception {
DataSourceService sourceService = DynamicDataSource.getInstance().getDataSource();
LocalDataSourceServiceImpl localDataSourceService = (LocalDataSourceServiceImpl) sourceService;
localDataSourceService.restoreDerby(restoreDB, callable);
}
Aggregations