此内容没有您所选择的语言版本。
Chapter 3. Reactive data source configuration
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
- Navigate to your Quarkus project directory.
In the
src/main/resources/application.propertiesfile, set the value of thequarkus.datasource.reactive.urlproperty 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_databaseOptionally, 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=20For example, to add a
postgresqldata 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
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
- Navigate to your Quarkus project directory.
-
Open the
src/main/resources/application.propertiesfile. Set the
quarkus.datasource.reactiveproperty tofalseto disable the reactive data source:quarkus.datasource.reactive=false