List of usage examples for io.vertx.mysqlclient MySQLPool pool
static MySQLPool pool(MySQLConnectOptions connectOptions, PoolOptions poolOptions)
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 ww . j av a 2 s . co m System.out.println("Failure: " + ar.cause().getMessage()); } // Now close the pool client.close(); }); }
From source file:examples.MySQLClientExamples.java
public void connecting01() { // 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 pooled client MySQLPool client = MySQLPool.pool(connectOptions, poolOptions); }