0

I am currently using Apache's MetaModel 4.6.0 API for Java 1.8. I am having trouble getting the default schema for the DataContext I want to use. Below is a snippet my code:

private DataContext dataContext;
private Schema schema;
private Table table;

/**
 * @brief Constructor that takes in an excel file
 * @detail Creates a schema for the excel file to be easily queried
 * @param excelFile 
 */
public ExcelQuery(File file)
{
    dataContext = new ExcelDataContext(file);
    schema = dataContext.getDefaultSchema();
    table = schema.getTables()[0];
}

When it gets to this part:

schema = dataContext.getDefaultSchema();

The code just hangs trying to perform this action. Any ideas why this would be happening?

My goal is to be able to query an excel file using this API. I have seen many examples do this and work, but can't seem to recreate it.

BlueMoose
  • 117
  • 11

1 Answers1

0

as you said DataContext.getDefaultSchema is not working Try to print all the schema by using

Schema[] schema = dc.getSchemas();

then try the correct schemaName.

Schema schema = dc.getSchemaByName(schemaName);
Gokul Raj
  • 26
  • 3