Search in sources :

Example 1 with JDBCSchemaReader

use of eu.esdihumboldt.hale.io.jdbc.JDBCSchemaReader in project hale by halestudio.

the class AbstractDBTest method readSchema.

/**
 * Load the database schema.
 *
 * @return the schema
 * @throws Exception if reading the schema fails
 */
protected Schema readSchema() throws Exception {
    JDBCSchemaReader schemaReader = new JDBCSchemaReader();
    schemaReader.setSource(new NoStreamInputSupplier(jdbcUri));
    schemaReader.setParameter(JDBCSchemaReader.PARAM_USER, Value.of(dbi.getUser()));
    schemaReader.setParameter(JDBCSchemaReader.PARAM_PASSWORD, Value.of(dbi.getPassword()));
    // This is set for setting inclusion rule for reading schema
    if (dbi.getDatabase().equalsIgnoreCase("ORCL")) {
        schemaReader.setParameter(JDBCSchemaReader.SCHEMAS, Value.of(dbi.getUser().toUpperCase()));
    }
    IOReport report = schemaReader.execute(null);
    assertTrue(report.isSuccess());
    assertTrue(report.getErrors().isEmpty());
    Schema schema = schemaReader.getSchema();
    assertNotNull(schema);
    return schema;
}
Also used : Schema(eu.esdihumboldt.hale.common.schema.model.Schema) IOReport(eu.esdihumboldt.hale.common.core.io.report.IOReport) JDBCSchemaReader(eu.esdihumboldt.hale.io.jdbc.JDBCSchemaReader) NoStreamInputSupplier(eu.esdihumboldt.hale.common.core.io.supplier.NoStreamInputSupplier)

Example 2 with JDBCSchemaReader

use of eu.esdihumboldt.hale.io.jdbc.JDBCSchemaReader in project hale by halestudio.

the class MsSqlDataReaderTest method readSchema.

/**
 * Reads a schema from a MS SQL database.
 *
 * @return the schema
 * @throws Exception any exception thrown by {@link JDBCSchemaReader}
 */
private Schema readSchema() throws Exception {
    JDBCSchemaReader schemaReader = new JDBCSchemaReader();
    JDBCURI = new MsSqlURIBuilder().createJdbcUri(HOST, DATABASE);
    schemaReader.setSource(new NoStreamInputSupplier(JDBCURI));
    schemaReader.setParameter(JDBCSchemaReader.PARAM_USER, Value.of(USER_NAME));
    schemaReader.setParameter(JDBCSchemaReader.PARAM_PASSWORD, Value.of(PASSWORD));
    // This is set for setting inclusion rule for reading schema
    schemaReader.setParameter(JDBCSchemaReader.SCHEMAS, Value.of(SCHEMA));
    IOReport report = schemaReader.execute(new LogProgressIndicator());
    assertTrue(report.isSuccess());
    assertTrue(report.getErrors().isEmpty());
    Schema schema = schemaReader.getSchema();
    assertNotNull(schema);
    return schema;
}
Also used : MsSqlURIBuilder(eu.esdihumboldt.hale.io.jdbc.mssql.MsSqlURIBuilder) Schema(eu.esdihumboldt.hale.common.schema.model.Schema) IOReport(eu.esdihumboldt.hale.common.core.io.report.IOReport) LogProgressIndicator(eu.esdihumboldt.hale.common.core.io.impl.LogProgressIndicator) JDBCSchemaReader(eu.esdihumboldt.hale.io.jdbc.JDBCSchemaReader) NoStreamInputSupplier(eu.esdihumboldt.hale.common.core.io.supplier.NoStreamInputSupplier)

Example 3 with JDBCSchemaReader

use of eu.esdihumboldt.hale.io.jdbc.JDBCSchemaReader in project hale by halestudio.

the class MsSQLServer14Test method readSchema.

/**
 * Reads a schema from a MS SQL database.
 *
 * @return the schema
 * @throws Exception any exception thrown by {@link JDBCSchemaReader}
 */
private Schema readSchema() throws Exception {
    JDBCSchemaReader schemaReader = new JDBCSchemaReader();
    JDBCURI = new MsSqlURIBuilder().createJdbcUri(HOST, DATABASE);
    schemaReader.setSource(new NoStreamInputSupplier(JDBCURI));
    schemaReader.setParameter(JDBCSchemaReader.PARAM_USER, Value.of(USER_NAME));
    schemaReader.setParameter(JDBCSchemaReader.PARAM_PASSWORD, Value.of(PASSWORD));
    // This is set for setting inclusion rule for reading schema
    schemaReader.setParameter(JDBCSchemaReader.SCHEMAS, Value.of(SCHEMA));
    IOReport report = schemaReader.execute(new LogProgressIndicator());
    assertTrue(report.isSuccess());
    assertTrue(report.getErrors().isEmpty());
    Schema schema = schemaReader.getSchema();
    assertNotNull(schema);
    return schema;
}
Also used : MsSqlURIBuilder(eu.esdihumboldt.hale.io.jdbc.mssql.MsSqlURIBuilder) Schema(eu.esdihumboldt.hale.common.schema.model.Schema) IOReport(eu.esdihumboldt.hale.common.core.io.report.IOReport) LogProgressIndicator(eu.esdihumboldt.hale.common.core.io.impl.LogProgressIndicator) JDBCSchemaReader(eu.esdihumboldt.hale.io.jdbc.JDBCSchemaReader) NoStreamInputSupplier(eu.esdihumboldt.hale.common.core.io.supplier.NoStreamInputSupplier)

Aggregations

IOReport (eu.esdihumboldt.hale.common.core.io.report.IOReport)3 NoStreamInputSupplier (eu.esdihumboldt.hale.common.core.io.supplier.NoStreamInputSupplier)3 Schema (eu.esdihumboldt.hale.common.schema.model.Schema)3 JDBCSchemaReader (eu.esdihumboldt.hale.io.jdbc.JDBCSchemaReader)3 LogProgressIndicator (eu.esdihumboldt.hale.common.core.io.impl.LogProgressIndicator)2 MsSqlURIBuilder (eu.esdihumboldt.hale.io.jdbc.mssql.MsSqlURIBuilder)2