io.vertx.jdbcclient

## Interface JDBCPool

- All Superinterfaces:
    Pool, SqlClient

      public interface JDBCPool
      extends Pool

  JDBCPool is the interface that allows using the Sql Client API with plain JDBC.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.util.function.Supplier<DataSourceProvider>` | `DEFAULT_DATA_SOURCE_PROVIDER` The default data source provider for this pool, loaded from JVM system properties with the `DataSourceProvider.DEFAULT_DATA_SOURCE_PROVIDER_NAME` key.
    `static PropertyKind<Row>` | `GENERATED_KEYS` The property to be used to retrieve the generated keys
    `static PropertyKind<Boolean>` | `OUTPUT` The property to be used to retrieve the output of the callable statement

  - ### Method Summary

    All Methods Static Methods Default Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JDBCPool` | `pool(Vertx vertx, DataSource dataSource)` Create a JDBC pool using a pre-initialized data source.
    `static JDBCPool` | `pool(Vertx vertx, DataSource dataSource, JsonObject config)` Deprecated.
    `static JDBCPool` | `pool(Vertx vertx, DataSourceProvider dataSourceProvider)` Create a JDBC pool which maintains its own data source.
    `static JDBCPool` | `pool(Vertx vertx, JDBCConnectOptions connectOptions, PoolOptions poolOptions)` Create a JDBC pool which maintains its own data source and the `default data source provider`.
    `static JDBCPool` | `pool(Vertx vertx, JDBCConnectOptions connectOptions, PoolOptions poolOptions, DataSourceProvider provider)` Create a JDBC pool which maintains its own data source, with the specified provider.
    `static JDBCPool` | `pool(Vertx vertx, JsonObject config)` Deprecated. instead use `pool(Vertx, JDBCConnectOptions, PoolOptions)`

    - ### Methods inherited from interface io.vertx.sqlclient.Pool

      `close, connectHandler, connectionProvider, getConnection, getConnection, pool, pool, pool, preparedQuery, query, size, withConnection, withConnection, withTransaction, withTransaction, withTransaction, withTransaction`

    - ### Methods inherited from interface io.vertx.sqlclient.SqlClient

      `close, preparedQuery`

- - ### Field Detail

    - #### DEFAULT_DATA_SOURCE_PROVIDER

          static final java.util.function.Supplier<DataSourceProvider> DEFAULT_DATA_SOURCE_PROVIDER

      The default data source provider for this pool, loaded from JVM system properties with the `DataSourceProvider.DEFAULT_DATA_SOURCE_PROVIDER_NAME` key. The value can be one of:
      - C3P0: `C3P0DataSourceProvider`
      - Hikari: `HikariCPDataSourceProvider`
      - Agroal: `AgroalCPDataSourceProvider`
      When there is no JVM wide defined provider or the value is incorrect, `AgroalCPDataSourceProvider` is returned.

    - #### GENERATED_KEYS

          static final PropertyKind<Row> GENERATED_KEYS

      The property to be used to retrieve the generated keys

    - #### OUTPUT

          static final PropertyKind<Boolean> OUTPUT

      The property to be used to retrieve the output of the callable statement

  - ### Method Detail

    - #### pool

          static JDBCPool pool(Vertx vertx,
                               JDBCConnectOptions connectOptions,
                               PoolOptions poolOptions)

      Create a JDBC pool which maintains its own data source and the `default data source provider`.
      Parameters:
        `vertx` - the Vert.x instance
        `connectOptions` - the options to configure the connection
        `poolOptions` - the connection pool options
      Returns:
        the client

    - #### pool

          static JDBCPool pool(Vertx vertx,
                               JDBCConnectOptions connectOptions,
                               PoolOptions poolOptions,
                               DataSourceProvider provider)

      Create a JDBC pool which maintains its own data source, with the specified provider.

      The datasource will be named after `PoolOptions.getName()`, even though the Javadoc in this class indicates that the name is only used when the `Pool` is shared.

      Parameters:
        `vertx` - the Vert.x instance
        `connectOptions` - the options to configure the connection
        `poolOptions` - the connection pool options
        `provider` - the data source provider
      Returns:
        the client

    - #### pool

          @Deprecated
          static JDBCPool pool(Vertx vertx,
                                           JsonObject config)

      Deprecated. instead use `pool(Vertx, JDBCConnectOptions, PoolOptions)`
      Create a JDBC pool which maintains its own data source.
      Parameters:
        `vertx` - the Vert.x instance
        `config` - the options to configure the client using the same format as `JDBCClient`
      Returns:
        the client

    - #### pool

          static JDBCPool pool(Vertx vertx,
                               DataSourceProvider dataSourceProvider)

      Create a JDBC pool which maintains its own data source.
      Parameters:
        `vertx` - the Vert.x instance
        `dataSourceProvider` - the options to configure the client using the same format as `JDBCClient`
      Returns:
        the client
      Since:
        4.2.0

    - #### pool

          static JDBCPool pool(Vertx vertx,
                               DataSource dataSource)

      Create a JDBC pool using a pre-initialized data source.
      Parameters:
        `vertx` - the Vert.x instance
        `dataSource` - a pre-initialized data source
      Returns:
        the client
      Since:
        4.2.0

    - #### pool

          @Deprecated
          static JDBCPool pool(Vertx vertx,
                                           DataSource dataSource,
                                           JsonObject config)

      Deprecated.
      Create a JDBC pool using a pre-initialized data source. The config expects that at least the following properties are set:
      - `url` - the connection string
      - `user` - the connection user name
      - `database` - the database name
      - `maxPoolSize` - the max allowed number of connections in the pool
      Parameters:
        `vertx` - the Vert.x instance
        `dataSource` - a pre-initialized data source
        `config` - the pool configuration
      Returns:
        the client
      Since:
        4.2.0

Copyright © 2025 Eclipse. All rights reserved.