Chapter 3. Configuring reactive data sources with Quarkus


You can use a reactive data source driver to connect your application to a relational database.

3.1. Setting the reactive data source connection URL

You must configure the connection URL for the reactive data source to complete configuration of your data source.

Prerequisites

  • You have a Quarkus Maven project.
  • You have added a reactive data source driver to your application.

Procedure

  1. Navigate to your Quarkus project directory.
  2. In the src/main/resources/application.properties file, set the value of the quarkus.datasource.reactive.url property to match the connection URL of your reactive data source:

    quarkus.datasource.reactive.url=<datasource_URL>

    For example, to set the reactive data source connection URL for the PostgreSQL data source:

    quarkus.datasource.reactive.url=postgresql:///your_database
  3. Optionally, you can set the maximum number of connections in the connection pool of your data source to improve the performance of your application:

    quarkus.datasource.reactive.max-size=20

    For example, to add a postgresql data source with a reactive data source driver:

    quarkus.datasource.db-kind=postgresql
    quarkus.datasource.username=<your_username>
    quarkus.datasource.password=<your_password>
    
    quarkus.datasource.reactive.url=postgresql://localhost:5432/quarkus_test_database
    quarkus.datasource.reactive.max-size=20

3.2. Disabling a reactive data source in a simultaneous configuration

You can simultaneously configure a reactive driver extension and a JDBC driver extension for the same data source in your application. You can disable the reactive data source driver in a simultaneous configuration, thus forcing your application to use the JDBC data source driver.

Prerequisites

  • You have a Quarkus Maven project.
  • You have a JDBC data source driver and a reactive data source driver configured simultaneously in your application.

Procedure

  1. Navigate to your Quarkus project directory.
  2. Open the src/main/resources/application.properties file.
  3. Set the quarkus.datasource.reactive property to false to disable the reactive data source:

    quarkus.datasource.reactive=false
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.