*/
static OptiqConnection getConnection(boolean withClone)
throws ClassNotFoundException, SQLException {
Class.forName("net.hydromatic.optiq.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:optiq:");
OptiqConnection optiqConnection =
connection.unwrap(OptiqConnection.class);
final SchemaPlus rootSchema = optiqConnection.getRootSchema();
final DataSource dataSource =
JdbcSchema.dataSource(
CONNECTION_SPEC.url,
CONNECTION_SPEC.driver,
CONNECTION_SPEC.username,
CONNECTION_SPEC.password);
final SchemaPlus foodmart =
rootSchema.add("foodmart",
JdbcSchema.create(rootSchema, "foodmart", dataSource, null,
"foodmart"));
if (withClone) {
rootSchema.add("foodmart2", new CloneSchema(foodmart));
}
optiqConnection.setSchema("foodmart2");
return optiqConnection;
}