use of io.vertx.db2client.DB2ConnectOptions in project smallrye-mutiny-vertx-bindings by smallrye.
the class DB2ClientTest method testMutinyAPI.
@Test
public void testMutinyAPI() {
DB2ConnectOptions options = new DB2ConnectOptions().setPort(container.getMappedPort(50000)).setHost(container.getContainerIpAddress()).setDatabase(container.getDatabaseName()).setUser(container.getUsername()).setPassword(container.getPassword());
Pool client = DB2Pool.pool(vertx, options, new PoolOptions().setMaxSize(5));
RowSet<?> join = client.query("SELECT 1 FROM SYSIBM.SYSDUMMY1").executeAndAwait();
assertThat(join).isNotNull();
assertThat(join.size()).isEqualTo(1);
}
use of io.vertx.db2client.DB2ConnectOptions in project vertx-sql-client by eclipse-vertx.
the class DB2ClientExamples method connecting02.
public void connecting02(Vertx vertx) {
// Connect options
DB2ConnectOptions connectOptions = new DB2ConnectOptions().setPort(50000).setHost("the-host").setDatabase("the-db").setUser("user").setPassword("secret");
// Pool options
PoolOptions poolOptions = new PoolOptions().setMaxSize(5);
// Create the pooled client
SqlClient client = DB2Pool.client(vertx, connectOptions, poolOptions);
}
use of io.vertx.db2client.DB2ConnectOptions in project vertx-sql-client by eclipse-vertx.
the class DB2ClientExamples method connectSsl.
public void connectSsl(Vertx vertx) {
DB2ConnectOptions options = new DB2ConnectOptions().setPort(50001).setHost("the-host").setDatabase("the-db").setUser("user").setPassword("secret").setSsl(true).setTrustStoreOptions(new JksOptions().setPath("/path/to/keystore.p12").setPassword("keystoreSecret"));
DB2Connection.connect(vertx, options, res -> {
if (res.succeeded()) {
// Connected with SSL
} else {
System.out.println("Could not connect " + res.cause());
}
});
}
use of io.vertx.db2client.DB2ConnectOptions in project vertx-sql-client by eclipse-vertx.
the class DB2ClientExamples method connecting01.
public void connecting01() {
// Connect options
DB2ConnectOptions connectOptions = new DB2ConnectOptions().setPort(50000).setHost("the-host").setDatabase("the-db").setUser("user").setPassword("secret");
// Pool options
PoolOptions poolOptions = new PoolOptions().setMaxSize(5);
// Create the pooled client
SqlClient client = DB2Pool.client(connectOptions, poolOptions);
}
use of io.vertx.db2client.DB2ConnectOptions in project vertx-sql-client by eclipse-vertx.
the class DB2ConnectionAutoRetryTest method initialConnector.
@Override
protected void initialConnector(int proxyPort) {
SqlConnectOptions proxyOptions = new DB2ConnectOptions(options);
proxyOptions.setPort(proxyPort);
proxyOptions.setHost("localhost");
connectionConnector = ClientConfig.CONNECT.connect(vertx, proxyOptions);
poolConnector = ClientConfig.POOLED.connect(vertx, proxyOptions);
}
Aggregations