List of usage examples for io.vertx.mysqlclient MySQLPool query
@Override MySQLPool query(String sql, Handler<AsyncResult<RowSet<Row>>> handler);
From source file:examples.MySQLClientExamples.java
public void gettingStarted() { // Connect options MySQLConnectOptions connectOptions = new MySQLConnectOptions().setPort(3306).setHost("the-host") .setDatabase("the-db").setUser("user").setPassword("secret"); // Pool options PoolOptions poolOptions = new PoolOptions().setMaxSize(5); // Create the client pool MySQLPool client = MySQLPool.pool(connectOptions, poolOptions); // A simple query client.query("SELECT * FROM users WHERE id='julien'", ar -> { if (ar.succeeded()) { RowSet<Row> result = ar.result(); System.out.println("Got " + result.size() + " rows "); } else {/*from w w w . j av a 2s.c om*/ System.out.println("Failure: " + ar.cause().getMessage()); } // Now close the pool client.close(); }); }