0

I use the quarkus framework, integrate hibernate reactive, and use the panache list method to query. I find that it do not use the connection pool, but use the connection directly. As a result, the query cannot be used after the connection is closed.

SqlClientConnection


public CompletionStage<RowSet<Row>> preparedQuery(String sql, Tuple parameters) {
        feedback(sql);
        String processedSql = usePostgresStyleParameters ? Parameters.process( sql, parameters.size() ) : sql;
        return Handlers.toCompletionStage(
                        handler -> client().preparedQuery( processedSql ).execute( parameters, handler )
        );
}

PanacheQueryImpl

  @Override
    public <T extends Entity> Uni<List<T>> list() {
        return delegate.list();
    }


I'd like to know how to use pool when querying?

Sanne
  • 6,027
  • 19
  • 34

1 Answers1

1

Technically it doesn't need a traditional connection pool, because all operations are non-blocking, so you can easily saturate your CPU completely with a single connection to the database.

In practice the default is to use a single connection for each Vert.x context, and by default you'll have two such contexts per CPU.

When you say "query cannot be used after the connection is closed" I suspect you're actually hitting a bug we fixed recently; please add more details to a new question; I suspect the solution for your issue (in that case) is that you need to use Panache Reactive from a non-blocking context, such as using RESTEasy Reactive for your endpoint.

Sanne
  • 6,027
  • 19
  • 34
  • Panache Reactive sounds interesting. Is there an extension for oracle db as well? – Blackbelt Sep 24 '21 at 15:34
  • 1
    Not yet, the Oracle SQL client is expected to first appear in vert.x 4.2; it's not released yet. (that's the component we need to have a high performance reactive replacement for the JDBC driver) – Sanne Sep 27 '21 at 09:05
  • thanks for you reply. I am really looking forward to it. Is there a place where i can follow the progress on it? (eg. A roadmap?) – Blackbelt Sep 27 '21 at 09:09
  • 1
    The project is fully open: https://github.com/eclipse-vertx/vertx-sql-client , https://vertx.io/ . There's chats and mailing lists. I hope to see you there :) – Sanne Sep 28 '21 at 10:04