本文整理汇总了Java中org.apache.ddlutils.platform.JdbcModelReader类的典型用法代码示例。如果您正苦于以下问题:Java JdbcModelReader类的具体用法?Java JdbcModelReader怎么用?Java JdbcModelReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JdbcModelReader类属于org.apache.ddlutils.platform包,在下文中一共展示了JdbcModelReader类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.apache.ddlutils.platform.JdbcModelReader; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void run() {
System.out.println("Indexer: Starting Index Target database");
System.out.println("Indexer: Connecting to target database...");
targetDatabaseMock = new TargetDatabaseMock();
try{
// Clear all in the service
AnalyseService service = ServiceProvider.getInstance().getAnalyseService();
service.clearAllTargetMetadata();
// Connect and fetch
TargetConnection targetConnection = ServiceProvider.getInstance().getDaoService().getTargetConnection();
DataSource dataSource = targetConnection.getDataSource();
System.out.println("Indexer: Reading database...");
Platform platform = PlatformFactory.createNewPlatformInstance(dataSource);
JdbcModelReader modelReader = platform.getModelReader();
//Database database = modelReader.getDatabase(targetConnection.getConnection(), targetConnection.getSchema(), null, targetConnection.getSchema(), null);
Database database = targetDatabaseMock.getDatabase();
service.setTargetDatabaseMetadata(database);
// Tables loop
for(Table table : database.getTables()) {
if (Thread.currentThread().isInterrupted()) {
System.out.println("Done: Cancelled!");
return;
}
String tableName = table.getName();
// Add table to list
service.addTargetTable(tableName, table);
// Add columns
ArrayList<Column> columns = new ArrayList<Column>();
Collections.addAll(columns, table.getColumns());
// Add to the service
service.addTargetColumns(table, columns);
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Done: Indexed Target database");
// Get on main thread and call the callback.
javafx.application.Platform.runLater(() -> callback.call(null));
}
示例2: getModelReader
import org.apache.ddlutils.platform.JdbcModelReader; //导入依赖的package包/类
/**
* Returns the model reader (which reads a database model from a live database) for this platform.
*
* @return The model reader
*/
public JdbcModelReader getModelReader();