Search in sources :

Example 11 with DB2ConnectOptions

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);
}
Also used : PoolOptions(io.vertx.sqlclient.PoolOptions) DB2ConnectOptions(io.vertx.db2client.DB2ConnectOptions) Pool(io.vertx.mutiny.sqlclient.Pool) DB2Pool(io.vertx.mutiny.db2client.DB2Pool) Test(org.junit.Test)

Example 12 with DB2ConnectOptions

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);
}
Also used : SqlClient(io.vertx.sqlclient.SqlClient) PoolOptions(io.vertx.sqlclient.PoolOptions) DB2ConnectOptions(io.vertx.db2client.DB2ConnectOptions)

Example 13 with DB2ConnectOptions

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());
        }
    });
}
Also used : JksOptions(io.vertx.core.net.JksOptions) DB2ConnectOptions(io.vertx.db2client.DB2ConnectOptions)

Example 14 with DB2ConnectOptions

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);
}
Also used : SqlClient(io.vertx.sqlclient.SqlClient) PoolOptions(io.vertx.sqlclient.PoolOptions) DB2ConnectOptions(io.vertx.db2client.DB2ConnectOptions)

Example 15 with DB2ConnectOptions

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);
}
Also used : SqlConnectOptions(io.vertx.sqlclient.SqlConnectOptions) DB2ConnectOptions(io.vertx.db2client.DB2ConnectOptions)

Aggregations

DB2ConnectOptions (io.vertx.db2client.DB2ConnectOptions)16 PoolOptions (io.vertx.sqlclient.PoolOptions)11 DB2Pool (io.vertx.db2client.DB2Pool)5 SqlClient (io.vertx.sqlclient.SqlClient)4 Vertx (io.vertx.core.Vertx)3 JksOptions (io.vertx.core.net.JksOptions)3 DB2Pool (io.vertx.mutiny.db2client.DB2Pool)3 Pool (io.vertx.mutiny.sqlclient.Pool)3 Row (io.vertx.sqlclient.Row)3 Collectors (java.util.stream.Collectors)3 Tuple2 (io.smallrye.mutiny.tuples.Tuple2)2 Future (io.vertx.core.Future)2 DB2Connection (io.vertx.db2client.DB2Connection)2 Source (io.vertx.docgen.Source)2 Row (io.vertx.mutiny.sqlclient.Row)2 RowSet (io.vertx.mutiny.sqlclient.RowSet)2 Pool (io.vertx.sqlclient.Pool)2 RowSet (io.vertx.sqlclient.RowSet)2 SqlConnectOptions (io.vertx.sqlclient.SqlConnectOptions)2 SqlResult (io.vertx.sqlclient.SqlResult)2