创建资源库
前置
- mysql
- 数据库 test
核心代码
KettleEnvironment.init();
DatabaseMeta databaseMeta = new DatabaseMeta("test-db", "MYSQL", "Native", "localhost",
"test1", "3306", "root", "toor@1234");
// 关闭mysql推荐SSL连接提示
databaseMeta.addExtraOption("MYSQL", "useSSL", "false");
repositoryMeta = new KettleDatabaseRepositoryMeta("test-repo", "test-repo", "test-repo", databaseMeta);
repository = new KettleDatabaseRepository();
repository.init(repositoryMeta);
repository.connectionDelegate.connect(true, true);
KettleDatabaseRepositoryCreationHelper helper = new KettleDatabaseRepositoryCreationHelper(repository);
helper.createRepositorySchema(null, false, new ArrayList<>(), false);
repository.connect("admin", "admin");
assertTrue(repository.isConnected());
标签:Java,repository,kettle,repo,new,test,资源库,databaseMeta
From: https://www.cnblogs.com/guanchaoguo/p/17061352.html