Search in sources :

Example 1 with OracleConnectOptions

use of io.vertx.oracleclient.OracleConnectOptions in project vertx-sql-client by eclipse-vertx.

the class OracleConnectionAutoRetryTest method initialConnector.

@Override
protected void initialConnector(int proxyPort) {
    OracleConnectOptions proxyOptions = new OracleConnectOptions(options);
    proxyOptions.setPort(proxyPort);
    proxyOptions.setHost("localhost");
    connectionConnector = ClientConfig.CONNECT.connect(vertx, proxyOptions);
    poolConnector = ClientConfig.POOLED.connect(vertx, proxyOptions);
}
Also used : OracleConnectOptions(io.vertx.oracleclient.OracleConnectOptions)

Example 2 with OracleConnectOptions

use of io.vertx.oracleclient.OracleConnectOptions in project vertx-sql-client by eclipse-vertx.

the class OracleClientExamples method connecting02.

public void connecting02(Vertx vertx) {
    // Connect options
    OracleConnectOptions connectOptions = new OracleConnectOptions().setPort(1521).setHost("the-host").setDatabase("the-db").setUser("user").setPassword("secret");
    // Pool options
    PoolOptions poolOptions = new PoolOptions().setMaxSize(5);
    // Create the pooled client
    OraclePool client = OraclePool.pool(vertx, connectOptions, poolOptions);
}
Also used : OracleConnectOptions(io.vertx.oracleclient.OracleConnectOptions) OraclePool(io.vertx.oracleclient.OraclePool)

Example 3 with OracleConnectOptions

use of io.vertx.oracleclient.OracleConnectOptions in project vertx-sql-client by eclipse-vertx.

the class OracleClientExamples method configureFromDataObject.

public void configureFromDataObject(Vertx vertx) {
    // Data object
    OracleConnectOptions connectOptions = new OracleConnectOptions().setPort(1521).setHost("the-host").setDatabase("the-db").setUser("user").setPassword("secret");
    // Pool Options
    PoolOptions poolOptions = new PoolOptions().setMaxSize(5);
    // Create the pool from the data object
    OraclePool pool = OraclePool.pool(vertx, connectOptions, poolOptions);
    pool.getConnection(ar -> {
    // Handling your connection
    });
}
Also used : OracleConnectOptions(io.vertx.oracleclient.OracleConnectOptions) OraclePool(io.vertx.oracleclient.OraclePool)

Example 4 with OracleConnectOptions

use of io.vertx.oracleclient.OracleConnectOptions in project vertx-sql-client by eclipse-vertx.

the class OraclePoolTest method testRunStandalone.

@Test
public void testRunStandalone(TestContext ctx) {
    Async async = ctx.async();
    OraclePool pool = createPool(new OracleConnectOptions(options), new PoolOptions());
    pool.query("SELECT id, randomnumber FROM WORLD").execute(ctx.asyncAssertSuccess(v -> {
        async.complete();
    }));
    async.await(4000);
}
Also used : TestContext(io.vertx.ext.unit.TestContext) io.vertx.sqlclient(io.vertx.sqlclient) Async(io.vertx.ext.unit.Async) OracleConnectOptions(io.vertx.oracleclient.OracleConnectOptions) OracleRule(io.vertx.oracleclient.test.junit.OracleRule) Vertx(io.vertx.core.Vertx) RunWith(org.junit.runner.RunWith) ContextInternal(io.vertx.core.impl.ContextInternal) Set(java.util.Set) Test(org.junit.Test) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) Future(io.vertx.core.Future) Function(java.util.function.Function) HashSet(java.util.HashSet) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) After(org.junit.After) Handler(io.vertx.core.Handler) ClassRule(org.junit.ClassRule) Collections(java.util.Collections) OraclePool(io.vertx.oracleclient.OraclePool) Before(org.junit.Before) OracleConnectOptions(io.vertx.oracleclient.OracleConnectOptions) OraclePool(io.vertx.oracleclient.OraclePool) Async(io.vertx.ext.unit.Async) Test(org.junit.Test)

Example 5 with OracleConnectOptions

use of io.vertx.oracleclient.OracleConnectOptions in project vertx-sql-client by eclipse-vertx.

the class OracleClientExamples method gettingStarted.

public void gettingStarted() {
    // Connect options
    OracleConnectOptions connectOptions = new OracleConnectOptions().setPort(1521).setHost("the-host").setDatabase("the-db").setUser("user").setPassword("secret");
    // Pool options
    PoolOptions poolOptions = new PoolOptions().setMaxSize(5);
    // Create the client pool
    OraclePool client = OraclePool.pool(connectOptions, poolOptions);
    // A simple query
    client.query("SELECT * FROM users WHERE id='julien'").execute(ar -> {
        if (ar.succeeded()) {
            RowSet<Row> result = ar.result();
            System.out.println("Got " + result.size() + " rows ");
        } else {
            System.out.println("Failure: " + ar.cause().getMessage());
        }
        // Now close the pool
        client.close();
    });
}
Also used : OracleConnectOptions(io.vertx.oracleclient.OracleConnectOptions) OraclePool(io.vertx.oracleclient.OraclePool)

Aggregations

OracleConnectOptions (io.vertx.oracleclient.OracleConnectOptions)14 OraclePool (io.vertx.oracleclient.OraclePool)9 Vertx (io.vertx.core.Vertx)5 Future (io.vertx.core.Future)4 ContextInternal (io.vertx.core.impl.ContextInternal)4 io.vertx.sqlclient (io.vertx.sqlclient)4 Function (java.util.function.Function)4 Handler (io.vertx.core.Handler)3 Async (io.vertx.ext.unit.Async)3 TestContext (io.vertx.ext.unit.TestContext)3 VertxUnitRunner (io.vertx.ext.unit.junit.VertxUnitRunner)3 OracleRule (io.vertx.oracleclient.test.junit.OracleRule)3 Collections (java.util.Collections)3 HashSet (java.util.HashSet)3 Set (java.util.Set)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 After (org.junit.After)3 Before (org.junit.Before)3 ClassRule (org.junit.ClassRule)3 Test (org.junit.Test)3