use of eu.esdihumboldt.hale.io.jdbc.msaccess.MsAccessInstanceReader in project hale by halestudio.
the class MsAccessDataReaderTestSuit method readInstances.
/**
* Reads instances from from a MsAccess database file with the provided
* schema.
*
* @param sourceSchema the schema of the source database
* @param sourceFile the file of the source database.
* @return the read instances
* @throws Exception any exception thrown by {@link MsAccessInstanceReader}
*/
public InstanceCollection readInstances(Schema sourceSchema, File sourceFile) throws Exception {
MsAccessInstanceReader instanceReader = new MsAccessInstanceReader();
instanceReader.setSource(new FileIOSupplier(sourceFile));
instanceReader.setSourceSchema(sourceSchema);
instanceReader.setParameter(JDBCInstanceReader.PARAM_USER, Value.of(USER_NAME));
instanceReader.setParameter(JDBCInstanceReader.PARAM_PASSWORD, Value.of(PASSWORD));
// Test instances
IOReport report = instanceReader.execute(new LogProgressIndicator());
assertTrue("Data import was not successfull.", report.isSuccess());
return instanceReader.getInstances();
}
Aggregations