use of org.eclipse.hono.service.base.jdbc.config.JdbcProperties in project hono by eclipse.
the class ClasspathSchemaCreator method runScript.
private Future<Void> runScript(final JdbcProperties jdbcProperties, final String script, final SpanContext ctx) {
final JDBCClient jdbcClient = JdbcProperties.dataSource(vertx, jdbcProperties);
final Promise<Void> clientCloseTracker = Promise.promise();
SQL.runTransactionally(jdbcClient, tracer, ctx, (connection, context) -> {
final var expanded = Statement.statement(script).expand();
log.debug("Creating database schema in [{}] with script: {}", jdbcProperties.getUrl(), expanded);
return expanded.query(jdbcClient).recover(SQL::translateException);
}).onComplete(ar -> jdbcClient.close(clientCloseTracker));
return clientCloseTracker.future();
}
Aggregations