org.springframework.batch.support.DatabaseType Java Examples

The following examples show how to use org.springframework.batch.support.DatabaseType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MyBatchConfig.java    From SpringBootBucket with MIT License 5 votes vote down vote up
/**
 * JobRepository,用来注册Job的容器
 * jobRepositor的定义需要dataSource和transactionManager,Spring Boot已为我们自动配置了
 * 这两个类,Spring可通过方法注入已有的Bean
 *
 * @param dataSource
 * @param transactionManager
 * @return
 * @throws Exception
 */
@Bean
public JobRepository jobRepository(DruidDataSource dataSource, PlatformTransactionManager transactionManager) throws Exception {
    JobRepositoryFactoryBean jobRepositoryFactoryBean = new JobRepositoryFactoryBean();
    jobRepositoryFactoryBean.setDataSource(dataSource);
    jobRepositoryFactoryBean.setTransactionManager(transactionManager);
    jobRepositoryFactoryBean.setDatabaseType(String.valueOf(DatabaseType.ORACLE));
    jobRepositoryFactoryBean.setMaxVarCharLength(5000);
    // 下面事务隔离级别的配置是针对Oracle的
    jobRepositoryFactoryBean.setIsolationLevelForCreate("ISOLATION_READ_COMMITTED");
    jobRepositoryFactoryBean.afterPropertiesSet();
    return jobRepositoryFactoryBean.getObject();
}
 
Example #2
Source File: JobConfiguration.java    From CogStack-Pipeline with Apache License 2.0 5 votes vote down vote up
private void executeSessionScripts(HikariDataSource mainDatasource, String driver) {
    //temp datasource required to get type
    DatabaseType type = null;

        switch (driver) {
            case "DERBY":
                break;
            case "DB2":
                break;
            case "DB2ZOS":
                break;
            case "HSQL":
                break;
            case "com.microsoft.sqlserver.jdbc.SQLServerDriver":
                mainDatasource.setConnectionInitSql("SET DATEFORMAT ymd;");
                break;
            case "MYSQL":
                break;
            case "ORACLE":
                break;
            case "POSTGRES":
                break;
            case "SYBASE":
                break;
            case "H2":
                break;
            case "SQLITE":
                break;
        }

}
 
Example #3
Source File: SimpleJobServiceFactoryBean.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
private int determineClobTypeToUse(String databaseType) {
	if (DatabaseType.SYBASE == DatabaseType.valueOf(databaseType.toUpperCase())) {
		return Types.LONGVARCHAR;
	}
	else {
		return Types.CLOB;
	}
}