up
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package su.xserver.iikocon.test;
|
||||
|
||||
import io.vertx.core.Vertx;
|
||||
import io.vertx.jdbcclient.JDBCConnectOptions;
|
||||
import io.vertx.jdbcclient.JDBCPool;
|
||||
import io.vertx.sqlclient.Pool;
|
||||
import io.vertx.sqlclient.PoolOptions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ClickHouseJDBCExample {
|
||||
private static final Logger log = LoggerFactory.getLogger(ClickHouseJDBCExample.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
Vertx vertx = Vertx.vertx();
|
||||
|
||||
JDBCConnectOptions connectOptions = new JDBCConnectOptions()
|
||||
.setJdbcUrl("jdbc:clickhouse://dl-import.aramagedec.ru:8123")
|
||||
.setDatabase("test")
|
||||
.setUser("clickhouse_admin")
|
||||
.setPassword("7002ITinsta11");
|
||||
|
||||
PoolOptions poolOptions = new PoolOptions()
|
||||
.setMaxSize(16);
|
||||
|
||||
Pool pool = JDBCPool.pool(vertx, connectOptions, poolOptions);
|
||||
|
||||
pool
|
||||
.query("SELECT 1")
|
||||
.execute()
|
||||
.onSuccess(rows -> {
|
||||
rows.forEach(row -> log.info(row.toJson().encodePrettily()));
|
||||
vertx.close();
|
||||
})
|
||||
.onFailure(err -> {
|
||||
log.error(err.getMessage());
|
||||
vertx.close();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user