The English version of quarkus.io is the official project site. Translated sites are community supported on a best-effort basis.

Datasources

Many projects that use data require connections to a relational database.

The usual way of obtaining connections to a database is to use a datasource and configure a JDBC driver. But you might also prefer using a reactive driver to connect to your database in a reactive way.

Quarkus has you covered either way:

  • For JDBC, the preferred datasource and connection pooling implementation is Agroal.

  • For reactive, we use the Vert.x reactive drivers.

Both are configured via unified and flexible configuration.

Agroal is a modern, lightweight connection pool implementation designed for very high performance and scalability, and features first class integration with the other components in Quarkus, such as security, transaction management components, health, and metrics.

This guide will explain how to:

  • configure a datasource, or multiple datasources

  • how to obtain a reference to those datasources in code

  • which pool tuning configuration properties are available

This guide is mainly about datasource configuration. If you want more details about how to consume and make use of a reactive datasource, please refer to the Reactive SQL clients guide.

TL;DR

This is a quick introduction to datasource configuration. If you want a better understanding of how all this works, this guide has a lot more information in the subsequent paragraphs.

Zero Config Setup (Dev Services)

When testing or running in dev mode Quarkus can even provide you with a zero config database out of the box, a feature we refer to as Dev Services. Depending on your database type you may need Docker installed in order to use this feature.

If you want to use Dev Services then all you need to do is include the relevant extension for the type of database you want, e.g. jdbc-postgresql, reactive-pg-client or both. Don’t configure a database URL, username and password - Quarkus will provide the database and you can just start coding without worrying about config.

See Databases Dev Services for more details and optional configurations.

JDBC datasource

Add the agroal extension plus one of jdbc-db2, jdbc-derby, jdbc-h2, jdbc-mariadb, jdbc-mssql, jdbc-mysql, jdbc-oracle or jdbc-postgresql.

Then configure your datasource:

quarkus.datasource.db-kind=postgresql (1)
quarkus.datasource.username=<your username>
quarkus.datasource.password=<your password>

quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/hibernate_orm_test
quarkus.datasource.jdbc.max-size=16
1 If you only have a single JDBC extension, or you are running tests and only have a single test scoped JDBC extension installed then this is optional. If there is only one possible extension we assume this is the correct one, and if a driver has been added with test scope then we assume that this should be used in testing.

Reactive datasource

Add the correct reactive extension for the database you are using: reactive-db2-client, reactive-mssql-client, reactive-mysql-client, reactive-oracle-client, or reactive-pg-client.

Then configure your reactive datasource:

quarkus.datasource.db-kind=postgresql (1)
quarkus.datasource.username=<your username>
quarkus.datasource.password=<your password>

quarkus.datasource.reactive.url=postgresql:///your_database
quarkus.datasource.reactive.max-size=20
1 As specified above this is optional.

Default datasource

A datasource can be either a JDBC datasource, a reactive one or both. It all depends on how you configure it and which extensions you added to your project.

To define a datasource, start with the following (note that this is only required if you have more than one database type installed):

quarkus.datasource.db-kind=h2

The database kind defines which type of database you will connect to.

We currently include these built-in database kinds:

  • DB2: db2

  • Derby: derby

  • H2: h2

  • MariaDB: mariadb

  • Microsoft SQL Server: mssql

  • MySQL: mysql

  • Oracle: oracle

  • PostgreSQL: postgresql, pgsql or pg

Giving Quarkus the database kind you are targeting will facilitate configuration. By using a JDBC driver extension and setting the kind in the configuration, Quarkus resolves the JDBC driver automatically, so you don’t need to configure it yourself. If you want to use a database kind that is not part of the built-in ones, use other and define the JDBC driver explicitly.

You can use any JDBC driver in a Quarkus app in JVM mode (see Using other databases). It is unlikely that it will work when compiling your application to a native executable though.

If you plan to make a native executable, we recommend you use the existing JDBC Quarkus extensions (or contribute one for your driver).

There is a good chance you will need to define some credentials to access your database.

This is done by configuring the following properties:

quarkus.datasource.username=<your username>
quarkus.datasource.password=<your password>

You can also retrieve the password from Vault by using a credential provider for your datasource.

Once you have defined the database kind and the credentials, you are ready to configure either a JDBC datasource, a reactive one, or both.

JDBC datasource

JDBC is the most common database connection pattern. You typically need a JDBC datasource when using Hibernate ORM.

Install the Maven dependencies

First, you will need to add the quarkus-agroal dependency to your project.

You can add it using a simple Maven command:

./mvnw quarkus:add-extension -Dextensions="agroal"

Agroal comes as a transitive dependency of the Hibernate ORM extension so if you are using Hibernate ORM, you don’t need to add the Agroal extension dependency explicitly.

You will also need to choose, and add, the Quarkus extension for your relational database driver.

Quarkus provides driver extensions for:

  • DB2 - jdbc-db2

  • Derby - jdbc-derby

  • H2 - jdbc-h2

  • MariaDB - jdbc-mariadb

  • Microsoft SQL Server - jdbc-mssql

  • MySQL - jdbc-mysql

  • Oracle - jdbc-oracle

  • PostgreSQL - jdbc-postgresql

Some other JDBC extensions can be found in the Quarkiverse such as:

See Use a database with no built-in extension or with a different driver if you want to use a JDBC driver for another database.

The H2 and Derby databases can normally be configured to run in "embedded mode"; the extension does not support compiling the embedded database engine into native executables.

Read Testing with in-memory databases (below) for suggestions regarding integration testing.

As usual, you can install the extension using add-extension.

To install the PostgreSQL driver dependency for instance, run the following command:

./mvnw quarkus:add-extension -Dextensions="jdbc-postgresql"

Configure the JDBC connection

Configuring your JDBC connection is easy, the only mandatory property is the JDBC URL.

quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/hibernate_orm_test

Note the jdbc prefix in the property name. All the configuration properties specific to JDBC have this prefix.

For more information about the JDBC URL format, please refer to the JDBC url reference section.

When using one of the built-in datasource kinds, the JDBC driver is resolved automatically to the following values:

Table 1. Database kind to JDBC driver mapping
Database kind JDBC driver XA driver

db2

com.ibm.db2.jcc.DBDriver

com.ibm.db2.jcc.DB2XADataSource

derby

org.apache.derby.jdbc.ClientDriver

org.apache.derby.jdbc.ClientXADataSource

h2

org.h2.Driver

org.h2.jdbcx.JdbcDataSource

mariadb

org.mariadb.jdbc.Driver

org.mariadb.jdbc.MySQLDataSource

mssql

com.microsoft.sqlserver.jdbc.SQLServerDriver

com.microsoft.sqlserver.jdbc.SQLServerXADataSource

mysql

com.mysql.cj.jdbc.Driver

com.mysql.cj.jdbc.MysqlXADataSource

oracle

oracle.jdbc.driver.OracleDriver

oracle.jdbc.xa.client.OracleXADataSource

postgresql

org.postgresql.Driver

org.postgresql.xa.PGXADataSource

As previously stated, most of the time, this automatic resolution will suit you and you won’t need to configure the driver.

Use a database with no built-in extension or with a different driver

You can use a specific driver if you need to (for instance for using the OpenTracing driver) or if you want to use a database for which Quarkus does not have a built-in JDBC driver extension.

Without an extension, the driver will work fine in any Quarkus app running in JVM mode. It is unlikely that it will work when compiling your application to a native executable though. If you plan to make a native executable, we recommend you use the existing JDBC Quarkus extensions (or contribute one for your driver).

Here is how you would use the OpenTracing driver:

quarkus.datasource.jdbc.driver=io.opentracing.contrib.jdbc.TracingDriver

Here is how you would define access to a database with no built-in support (in JVM mode):

quarkus.datasource.db-kind=other
quarkus.datasource.jdbc.driver=oracle.jdbc.driver.OracleDriver
quarkus.datasource.jdbc.url=jdbc:oracle:thin:@192.168.1.12:1521/ORCL_SVC
quarkus.datasource.username=scott
quarkus.datasource.password=tiger

More configuration

You can configure a lot more things, for instance the size of the connection pool.

Please refer to the JDBC configuration reference for all the details about the JDBC configuration knobs.

Consuming the datasource

If you are using Hibernate ORM, the datasource will be consumed automatically.

If for whatever reason, access to the datasource is needed in code, it can be obtained as any other bean in the following manner:

@Inject
AgroalDataSource defaultDataSource;

In the above example, the type is AgroalDataSource which is a subtype of javax.sql.DataSource. Because of this, you can also use javax.sql.DataSource as the injected type.

Reactive datasource

If you prefer using a reactive datasource, Quarkus offers DB2, MariaDB/MySQL, Microsoft SQL Server, Oracle and PostgreSQL reactive clients.

Install the Maven dependencies

Depending on which database you want to use, add the corresponding extension:

  • DB2: quarkus-reactive-db2-client

  • MariaDB/MySQL: quarkus-reactive-mysql-client

  • Microsoft SQL Server: quarkus-reactive-mssql-client

  • Oracle: quarkus-reactive-oracle-client

  • PostgreSQL: quarkus-reactive-pg-client

The installed extension must be consistent with the quarkus.datasource.db-kind you define in your datasource configuration.

Configure the reactive datasource

Once the driver is there, you just need to configure the connection URL.

Optionally, but highly recommended, you should define a proper size for your connection pool.

quarkus.datasource.reactive.url=postgresql:///your_database
quarkus.datasource.reactive.max-size=20

JDBC and reactive datasources simultaneously

By default, if you include both a JDBC extension (+ Agroal) and a reactive datasource extension handling the given database kind, both will be created.

If you want to disable the JDBC datasource explicitly, use:

quarkus.datasource.jdbc=false

If you want to disable the reactive datasource explicitly, use:

quarkus.datasource.reactive=false

Most of the time, the configuration above won’t be necessary as either a JDBC driver or a reactive datasource extension will be present and not both.

Multiple Datasources

Configuring Multiple Datasources

For now, multiple datasources are only supported for JDBC and the Agroal extension. So it is not currently possible to create multiple reactive datasources.

The Hibernate ORM extension supports defining several persistence units using configuration properties. For each persistence unit, you can point to the datasource of your choice.

Defining multiple datasources works exactly the same way as defining a single datasource, with one important change: you define a name.

In the following example, you have 3 different datasources:

  • The default one,

  • A datasource named users,

  • A datasource named inventory,

each with its own configuration.

quarkus.datasource.db-kind=h2
quarkus.datasource.username=username-default
quarkus.datasource.jdbc.url=jdbc:h2:mem:default
quarkus.datasource.jdbc.max-size=13

quarkus.datasource.users.db-kind=h2
quarkus.datasource.users.username=username1
quarkus.datasource.users.jdbc.url=jdbc:h2:mem:users
quarkus.datasource.users.jdbc.max-size=11

quarkus.datasource.inventory.db-kind=h2
quarkus.datasource.inventory.username=username2
quarkus.datasource.inventory.jdbc.url=jdbc:h2:mem:inventory
quarkus.datasource.inventory.jdbc.max-size=12

Notice there is an extra bit in the key. The syntax is as follows: quarkus.datasource.[optional name.][datasource property].

Even when only one database extension is installed, named databases need to specify at least one build time property so that Quarkus knows they exist. Generally this will be the db-kind property, although you can also specify Dev Services properties to create named datasources (covered later in this guide).

Named Datasource Injection

When using multiple datasources, each DataSource also has the io.quarkus.agroal.DataSource qualifier with the name of the datasource as the value. Using the above properties to configure three different datasources, you can also inject each one as follows:

@Inject
AgroalDataSource defaultDataSource;

@Inject
@DataSource("users")
AgroalDataSource usersDataSource;

@Inject
@DataSource("inventory")
AgroalDataSource inventoryDataSource;

Datasource Health Check

If you are using the quarkus-smallrye-health extension, the quarkus-agroal and reactive client extensions will automatically add a readiness health check to validate the datasource.

When you access the /q/health/ready endpoint of your application you will have information about the datasource validation status. If you have multiple datasources, all datasources will be checked and the status will be DOWN as soon as there is one datasource validation failure.

This behavior can be disabled via the property quarkus.datasource.health.enabled.

Datasource Metrics

If you are using the quarkus-micrometer or quarkus-smallrye-metrics extension, quarkus-agroal can expose some data source metrics on the /q/metrics endpoint. This can be turned on by setting the property quarkus.datasource.metrics.enabled to true.

For the exposed metrics to contain any actual values, it is necessary that metric collection is enabled internally by Agroal mechanisms. By default, this metric collection mechanism gets turned on for all data sources if a metrics extension is present and metrics for the Agroal extension are enabled. If you want to disable metrics for a particular data source, this can be done by setting quarkus.datasource.jdbc.enable-metrics to false (or quarkus.datasource.<datasource name>.jdbc.enable-metrics for a named datasource). This disables collecting the metrics as well as exposing them in the /q/metrics endpoint, because it does not make sense to expose metrics if the mechanism to collect them is disabled.

Conversely, setting quarkus.datasource.jdbc.enable-metrics to true (or quarkus.datasource.<datasource name>.jdbc.enable-metrics for a named datasource) explicitly can be used to enable collection of metrics even if a metrics extension is not in use. This can be useful if you need to access the collected metrics programmatically. They are available after calling dataSource.getMetrics() on an injected AgroalDataSource instance. If collection of metrics is disabled for this data source, all values will be zero.

Narayana Transaction Manager integration

If the Narayana JTA extension is also available, integration is automatic.

You can override this by setting the transactions configuration property - see the Configuration Reference below.

Named Datasources

When using Dev Services the default datasource will always be created, but to specify a named datasource you need to have at least one build time property so Quarkus knows to create the datasource. You will usually either specify the db-kind property, or explicitly enable Dev Services: quarkus.datasource."name".devservices.enabled=true.

Testing with in-memory databases

Some databases like H2 and Derby are commonly used in "embedded mode" as a facility to run quick integration tests.

Our suggestion is to use the real database you intend to use in production; container technologies made this simple enough so you no longer have an excuse. Still, there are sometimes good reasons to also want the ability to run quick integration tests using the JVM powered databases, so this is possible as well.

It is important to remember that when configuring H2 (or Derby) to use the embedded engine, this will work as usual in JVM mode but such an application will not compile into a native executable, as the Quarkus extensions only cover for making the JDBC client code compatible with the native compilation step: embedding the whole database engine into a native executable is currently not implemented.

If you plan to run such integration tests in the JVM exclusively, it will of course work as usual.

If you want the ability to run such integration test in both JVM and/or native executables, we have some cool helpers for you: just add either @QuarkusTestResource(H2DatabaseTestResource.class) or @QuarkusTestResource(DerbyDatabaseTestResource.class) on any class in your integration tests, this will make sure the test suite starts (and stops) the embedded database into a separate process as necessary to run your tests.

These additional helpers are provided by the artifacts having Maven coordinates io.quarkus:quarkus-test-h2 and io.quarkus:quarkus-test-derby, respectively for H2 and Derby.

Follows an example for H2:

package my.app.integrationtests.db;

import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.h2.H2DatabaseTestResource;

@QuarkusTestResource(H2DatabaseTestResource.class)
public class TestResources {
}

This will allow you to test your application even when it’s compiled into a native executable, while the database will run in the JVM as usual.

Connect to it using:

quarkus.datasource.db-kind=h2
quarkus.datasource.jdbc.url=jdbc:h2:mem:test

Common Datasource Configuration Reference

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

类型

默认

The kind of database we will connect to (e.g. h2, postgresql…​).

Environment variable: QUARKUS_DATASOURCE_DB_KIND

string

If DevServices has been explicitly enabled or disabled. DevServices is generally enabled by default, unless there is an existing configuration present. When DevServices is enabled Quarkus will attempt to automatically configure and start a database when running in Dev or Test mode.

Environment variable: QUARKUS_DATASOURCE_DEVSERVICES_ENABLED

boolean

The container image name to use, for container based DevServices providers. If the provider is not container based (e.g. a H2 Database) then this has no effect.

Environment variable: QUARKUS_DATASOURCE_DEVSERVICES_IMAGE_NAME

string

Optional fixed port the dev service will listen to. If not defined, the port will be chosen randomly.

Environment variable: QUARKUS_DATASOURCE_DEVSERVICES_PORT

int

The container start command to use, for container based DevServices providers. If the provider is not container based (e.g. a H2 Database) then this has no effect.

Environment variable: QUARKUS_DATASOURCE_DEVSERVICES_COMMAND

string

The name of the database to use if this Dev Service supports overriding it.

Environment variable: QUARKUS_DATASOURCE_DEVSERVICES_DB_NAME

string

The username to use if this Dev Service supports overriding it.

Environment variable: QUARKUS_DATASOURCE_DEVSERVICES_USERNAME

string

The password to use if this Dev Service supports overriding it.

Environment variable: QUARKUS_DATASOURCE_DEVSERVICES_PASSWORD

string

Whether this particular data source should be excluded from the health check if the general health check for data sources is enabled. By default, the health check includes all configured data sources (if it is enabled).

Environment variable: QUARKUS_DATASOURCE_HEALTH_EXCLUDE

boolean

false

Whether or not an health check is published in case the smallrye-health extension is present. This is a global setting and is not specific to a datasource.

Environment variable: QUARKUS_DATASOURCE_HEALTH_ENABLED

boolean

true

Whether or not datasource metrics are published in case a metrics extension is present. This is a global setting and is not specific to a datasource. NOTE: This is different from the "jdbc.enable-metrics" property that needs to be set on the JDBC datasource level to enable collection of metrics for that datasource.

Environment variable: QUARKUS_DATASOURCE_METRICS_ENABLED

boolean

false

The datasource username

Environment variable: QUARKUS_DATASOURCE_USERNAME

string

The datasource password

Environment variable: QUARKUS_DATASOURCE_PASSWORD

string

The credentials provider name

Environment variable: QUARKUS_DATASOURCE_CREDENTIALS_PROVIDER

string

The credentials provider bean name. It is the &#64;Named value of the credentials provider bean. It is used to discriminate if multiple CredentialsProvider beans are available. For Vault it is: vault-credentials-provider. Not necessary if there is only one credentials provider available.

Environment variable: QUARKUS_DATASOURCE_CREDENTIALS_PROVIDER_NAME

string

Generic properties that are passed for additional container configuration. Properties defined here are database specific and are interpreted specifically in each database dev service implementation.

Environment variable: QUARKUS_DATASOURCE_DEVSERVICES_CONTAINER_PROPERTIES

Map<String,String>

Generic properties that are added to the database connection URL.

Environment variable: QUARKUS_DATASOURCE_DEVSERVICES_PROPERTIES

Map<String,String>

Additional named datasources

类型

默认

The kind of database we will connect to (e.g. h2, postgresql…​).

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__DB_KIND

string

If DevServices has been explicitly enabled or disabled. DevServices is generally enabled by default, unless there is an existing configuration present. When DevServices is enabled Quarkus will attempt to automatically configure and start a database when running in Dev or Test mode.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__DEVSERVICES_ENABLED

boolean

The container image name to use, for container based DevServices providers. If the provider is not container based (e.g. a H2 Database) then this has no effect.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__DEVSERVICES_IMAGE_NAME

string

Generic properties that are passed for additional container configuration. Properties defined here are database specific and are interpreted specifically in each database dev service implementation.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__DEVSERVICES_CONTAINER_PROPERTIES

Map<String,String>

Generic properties that are added to the database connection URL.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__DEVSERVICES_PROPERTIES

Map<String,String>

Optional fixed port the dev service will listen to. If not defined, the port will be chosen randomly.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__DEVSERVICES_PORT

int

The container start command to use, for container based DevServices providers. If the provider is not container based (e.g. a H2 Database) then this has no effect.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__DEVSERVICES_COMMAND

string

The name of the database to use if this Dev Service supports overriding it.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__DEVSERVICES_DB_NAME

string

The username to use if this Dev Service supports overriding it.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__DEVSERVICES_USERNAME

string

The password to use if this Dev Service supports overriding it.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__DEVSERVICES_PASSWORD

string

Whether this particular data source should be excluded from the health check if the general health check for data sources is enabled. By default, the health check includes all configured data sources (if it is enabled).

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__HEALTH_EXCLUDE

boolean

false

The datasource username

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__USERNAME

string

The datasource password

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__PASSWORD

string

The credentials provider name

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__CREDENTIALS_PROVIDER

string

The credentials provider bean name. It is the &#64;Named value of the credentials provider bean. It is used to discriminate if multiple CredentialsProvider beans are available. For Vault it is: vault-credentials-provider. Not necessary if there is only one credentials provider available.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__CREDENTIALS_PROVIDER_NAME

string

JDBC Configuration Reference

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

类型

默认

If we create a JDBC datasource for this datasource.

Environment variable: QUARKUS_DATASOURCE_JDBC

boolean

true

The datasource driver class name

Environment variable: QUARKUS_DATASOURCE_JDBC_DRIVER

string

Whether we want to use regular JDBC transactions, XA, or disable all transactional capabilities. When enabling XA you will need a driver implementing javax.sql.XADataSource.

Environment variable: QUARKUS_DATASOURCE_JDBC_TRANSACTIONS

enabled, xa, disabled

enabled

Enable datasource metrics collection. If unspecified, collecting metrics will be enabled by default if a metrics extension is active.

Environment variable: QUARKUS_DATASOURCE_JDBC_ENABLE_METRICS

boolean

Enable JDBC tracing. Disabled by default.

Environment variable: QUARKUS_DATASOURCE_JDBC_TRACING

boolean

false

The datasource URL

Environment variable: QUARKUS_DATASOURCE_JDBC_URL

string

The initial size of the pool. Usually you will want to set the initial size to match at least the minimal size, but this is not enforced so to allow for architectures which prefer a lazy initialization of the connections on boot, while being able to sustain a minimal pool size after boot.

Environment variable: QUARKUS_DATASOURCE_JDBC_INITIAL_SIZE

int

The datasource pool minimum size

Environment variable: QUARKUS_DATASOURCE_JDBC_MIN_SIZE

int

0

The datasource pool maximum size

Environment variable: QUARKUS_DATASOURCE_JDBC_MAX_SIZE

int

20

The interval at which we validate idle connections in the background. Set to 0 to disable background validation.

Environment variable: QUARKUS_DATASOURCE_JDBC_BACKGROUND_VALIDATION_INTERVAL

Duration

2M

Perform foreground validation on connections that have been idle for longer than the specified interval.

Environment variable: QUARKUS_DATASOURCE_JDBC_FOREGROUND_VALIDATION_INTERVAL

Duration

The timeout before cancelling the acquisition of a new connection

Environment variable: QUARKUS_DATASOURCE_JDBC_ACQUISITION_TIMEOUT

Duration

5

The interval at which we check for connection leaks.

Environment variable: QUARKUS_DATASOURCE_JDBC_LEAK_DETECTION_INTERVAL

Duration

The interval at which we try to remove idle connections.

Environment variable: QUARKUS_DATASOURCE_JDBC_IDLE_REMOVAL_INTERVAL

Duration

5M

The max lifetime of a connection.

Environment variable: QUARKUS_DATASOURCE_JDBC_MAX_LIFETIME

Duration

The transaction isolation level.

Environment variable: QUARKUS_DATASOURCE_JDBC_TRANSACTION_ISOLATION_LEVEL

undefined, none, read-uncommitted, read-committed, repeatable-read, serializable

Collect and display extra troubleshooting info on leaked connections.

Environment variable: QUARKUS_DATASOURCE_JDBC_EXTENDED_LEAK_REPORT

boolean

false

Allows connections to be flushed upon return to the pool. It’s not enabled by default.

Environment variable: QUARKUS_DATASOURCE_JDBC_FLUSH_ON_CLOSE

boolean

false

When enabled Agroal will be able to produce a warning when a connection is returned to the pool without the application having closed all open statements. This is unrelated with tracking of open connections. Disable for peak performance, but only when there’s high confidence that no leaks are happening.

Environment variable: QUARKUS_DATASOURCE_JDBC_DETECT_STATEMENT_LEAKS

boolean

true

Query executed when first using a connection.

Environment variable: QUARKUS_DATASOURCE_JDBC_NEW_CONNECTION_SQL

string

Query executed to validate a connection.

Environment variable: QUARKUS_DATASOURCE_JDBC_VALIDATION_QUERY_SQL

string

Disable pooling to prevent reuse of Connections. Use this with when an external pool manages the life-cycle of Connections.

Environment variable: QUARKUS_DATASOURCE_JDBC_POOLING_ENABLED

boolean

true

Require an active transaction when acquiring a connection. Recommended for production. WARNING: Some extensions acquire connections without holding a transaction for things like schema updates and schema validation. Setting this setting to STRICT may lead to failures in those cases.

Environment variable: QUARKUS_DATASOURCE_JDBC_TRANSACTION_REQUIREMENT

off, warn, strict

Enable JDBC tracing.

Environment variable: QUARKUS_DATASOURCE_JDBC_TRACING_ENABLED

boolean

false if quarkus.datasource.jdbc.tracing=false and true if quarkus.datasource.jdbc.tracing=true

Trace calls with active Spans only

Environment variable: QUARKUS_DATASOURCE_JDBC_TRACING_TRACE_WITH_ACTIVE_SPAN_ONLY

boolean

false

Ignore specific queries from being traced

Environment variable: QUARKUS_DATASOURCE_JDBC_TRACING_IGNORE_FOR_TRACING

string

Ignore specific queries from being traced, multiple queries can be specified separated by semicolon, double quotes should be escaped with \

Other unspecified properties to be passed to the JDBC driver when creating new connections.

Environment variable: QUARKUS_DATASOURCE_JDBC_ADDITIONAL_JDBC_PROPERTIES

Map<String,String>

Additional named datasources

类型

默认

If we create a JDBC datasource for this datasource.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC

boolean

true

The datasource driver class name

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_DRIVER

string

Whether we want to use regular JDBC transactions, XA, or disable all transactional capabilities. When enabling XA you will need a driver implementing javax.sql.XADataSource.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_TRANSACTIONS

enabled, xa, disabled

enabled

Enable datasource metrics collection. If unspecified, collecting metrics will be enabled by default if a metrics extension is active.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_ENABLE_METRICS

boolean

Enable JDBC tracing. Disabled by default.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_TRACING

boolean

false

The datasource URL

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_URL

string

The initial size of the pool. Usually you will want to set the initial size to match at least the minimal size, but this is not enforced so to allow for architectures which prefer a lazy initialization of the connections on boot, while being able to sustain a minimal pool size after boot.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_INITIAL_SIZE

int

The datasource pool minimum size

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_MIN_SIZE

int

0

The datasource pool maximum size

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_MAX_SIZE

int

20

The interval at which we validate idle connections in the background. Set to 0 to disable background validation.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_BACKGROUND_VALIDATION_INTERVAL

Duration

2M

Perform foreground validation on connections that have been idle for longer than the specified interval.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_FOREGROUND_VALIDATION_INTERVAL

Duration

The timeout before cancelling the acquisition of a new connection

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_ACQUISITION_TIMEOUT

Duration

5

The interval at which we check for connection leaks.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_LEAK_DETECTION_INTERVAL

Duration

The interval at which we try to remove idle connections.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_IDLE_REMOVAL_INTERVAL

Duration

5M

The max lifetime of a connection.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_MAX_LIFETIME

Duration

The transaction isolation level.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_TRANSACTION_ISOLATION_LEVEL

undefined, none, read-uncommitted, read-committed, repeatable-read, serializable

Collect and display extra troubleshooting info on leaked connections.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_EXTENDED_LEAK_REPORT

boolean

false

Allows connections to be flushed upon return to the pool. It’s not enabled by default.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_FLUSH_ON_CLOSE

boolean

false

When enabled Agroal will be able to produce a warning when a connection is returned to the pool without the application having closed all open statements. This is unrelated with tracking of open connections. Disable for peak performance, but only when there’s high confidence that no leaks are happening.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_DETECT_STATEMENT_LEAKS

boolean

true

Query executed when first using a connection.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_NEW_CONNECTION_SQL

string

Query executed to validate a connection.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_VALIDATION_QUERY_SQL

string

Disable pooling to prevent reuse of Connections. Use this with when an external pool manages the life-cycle of Connections.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_POOLING_ENABLED

boolean

true

Require an active transaction when acquiring a connection. Recommended for production. WARNING: Some extensions acquire connections without holding a transaction for things like schema updates and schema validation. Setting this setting to STRICT may lead to failures in those cases.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_TRANSACTION_REQUIREMENT

off, warn, strict

Other unspecified properties to be passed to the JDBC driver when creating new connections.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_ADDITIONAL_JDBC_PROPERTIES

Map<String,String>

Enable JDBC tracing.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_TRACING_ENABLED

boolean

false if quarkus.datasource.jdbc.tracing=false and true if quarkus.datasource.jdbc.tracing=true

Trace calls with active Spans only

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_TRACING_TRACE_WITH_ACTIVE_SPAN_ONLY

boolean

false

Ignore specific queries from being traced

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__JDBC_TRACING_IGNORE_FOR_TRACING

string

Ignore specific queries from being traced, multiple queries can be specified separated by semicolon, double quotes should be escaped with \

About the Duration format

持续时间的格式使用标准的 java.time.Duration 格式您可以在 Duration#parse() javadoc 中了解更多信息。

您还可以提供以数字开头的持续时间值。 在这种情况下,如果该值仅包含一个数字,则转换器将该值视为秒。 否则,PT 会隐式添加到值的前面,以获得标准的 java.time.Duration 格式。

JDBC URL Reference

Each of the supported databases contains different JDBC URL configuration options. Going into each of those options is beyond the scope of this document, but the following section gives an overview of each database URL and a link to the official documentation.

DB2

jdbc:db2://<serverName>[:<portNumber>]/<databaseName>[:<key1>=<value>;[<key2>=<value2>;]]

Example

jdbc:db2://localhost:50000/MYDB:user=dbadm;password=dbadm;

See the official documentation for more detail on URL syntax and additional supported options.

Derby

jdbc:derby:[//serverName[:portNumber]/][memory:]databaseName[;property=value[;property=value]]

Example

jdbc:derby://localhost:1527/myDB, jdbc:derby:memory:myDB;create=true

Derby is an embedded database. It can run as a server, based on a file, or live completely in memory. All of these options are available as listed above. You can find more information at the official documentation.

H2

jdbc:h2:{ {.|mem:}[name] | [file:]fileName | {tcp|ssl}:[//]server[:port][,server2[:port]]/name }[;key=value…​]

Example

jdbc:h2:tcp://localhost/~/test, jdbc:h2:mem:myDB

H2 is an embedded database. It can run as a server, based on a file, or live completely in memory. All of these options are available as listed above. You can find more information at the official documentation.

MariaDB

jdbc:mariadb:[replication:|failover:|sequential:|aurora:]//<hostDescription>[,<hostDescription>…​]/[database][?<key1>=<value1>[&<key2>=<value2>]] hostDescription:: <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]

Example

jdbc:mariadb://localhost:3306/test

You can find more information about this feature and others detailed in the official documentation.

Microsoft SQL Server

jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]

Example

jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks

The Microsoft SQL Server JDBC driver works essentially the same as the others. More details can be found in the official documentation.

MySQL

jdbc:mysql:[replication:|failover:|sequential:|aurora:]//<hostDescription>[,<hostDescription>…​]/[database][?<key1>=<value1>[&<key2>=<value2>]] hostDescription:: <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]

Example

jdbc:mysql://localhost:3306/test

You can find more information about this feature and others detailed in the official documentation.

MySQL Limitations

When compiling a Quarkus application to native-image, the MySQL support for JMX and Oracle Cloud Infrastructure (OCI) integrations are disabled as they are not compatible with GraalVM native-images. The lack of JMX support is a natural consequence of running in native and is unlikely to be resolved. The integration with OCI could be resolved, if you need it we suggest opening a support request with the MySQL Connector/J maintainers.

Oracle

jdbc:oracle:driver_type:@database_specifier

Example

jdbc:oracle:thin:@localhost:1521/ORCL_SVC

More details can be found in the official documentation.

PostgreSQL

PostgreSQL only runs as a server, as do the rest of the databases below. As such, you must specify connection details, or use the defaults.

jdbc:postgresql:[//][host][:port][/database][?key=value…​]

Example

jdbc:postgresql://localhost/test

Defaults for the different parts are as follows:

host

localhost

port

5432

database

same name as the username

The official documentation go into more detail and list optional parameters as well.

Reactive Datasource Configuration Reference

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

类型

默认

If we create a Reactive datasource for this datasource.

Environment variable: QUARKUS_DATASOURCE_REACTIVE

boolean

true

Whether prepared statements should be cached on the client side.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_CACHE_PREPARED_STATEMENTS

boolean

false

The datasource URL.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_URL

string

The datasource pool maximum size.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_MAX_SIZE

int

When a new connection object is created, the pool assigns it an event loop. When #event-loop-size is set to a strictly positive value, the pool assigns as many event loops as specified, in a round-robin fashion. By default, the number of event loops configured or calculated by Quarkus is used. If #event-loop-size is set to zero or a negative value, the pool assigns the current event loop to the new connection.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_EVENT_LOOP_SIZE

int

Whether all server certificates should be trusted.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_TRUST_ALL

boolean

false

PEM Trust config is disabled by default.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_TRUST_CERTIFICATE_PEM

boolean

false

Comma-separated list of the trust certificate files (Pem format).

Environment variable: QUARKUS_DATASOURCE_REACTIVE_TRUST_CERTIFICATE_PEM_CERTS

list of string

JKS config is disabled by default.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_TRUST_CERTIFICATE_JKS

boolean

false

Path of the key file (JKS format).

Environment variable: QUARKUS_DATASOURCE_REACTIVE_TRUST_CERTIFICATE_JKS_PATH

string

Password of the key file.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_TRUST_CERTIFICATE_JKS_PASSWORD

string

PFX config is disabled by default.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_TRUST_CERTIFICATE_PFX

boolean

false

Path to the key file (PFX format).

Environment variable: QUARKUS_DATASOURCE_REACTIVE_TRUST_CERTIFICATE_PFX_PATH

string

Password of the key.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_TRUST_CERTIFICATE_PFX_PASSWORD

string

PEM Key/cert config is disabled by default.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_KEY_CERTIFICATE_PEM

boolean

false

Comma-separated list of the path to the key files (Pem format).

Environment variable: QUARKUS_DATASOURCE_REACTIVE_KEY_CERTIFICATE_PEM_KEYS

list of string

Comma-separated list of the path to the certificate files (Pem format).

Environment variable: QUARKUS_DATASOURCE_REACTIVE_KEY_CERTIFICATE_PEM_CERTS

list of string

JKS config is disabled by default.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_KEY_CERTIFICATE_JKS

boolean

false

Path of the key file (JKS format).

Environment variable: QUARKUS_DATASOURCE_REACTIVE_KEY_CERTIFICATE_JKS_PATH

string

Password of the key file.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_KEY_CERTIFICATE_JKS_PASSWORD

string

PFX config is disabled by default.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_KEY_CERTIFICATE_PFX

boolean

false

Path to the key file (PFX format).

Environment variable: QUARKUS_DATASOURCE_REACTIVE_KEY_CERTIFICATE_PFX_PATH

string

Password of the key.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_KEY_CERTIFICATE_PFX_PASSWORD

string

The number of reconnection attempts when a pooled connection cannot be established on first try.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_RECONNECT_ATTEMPTS

int

0

The interval between reconnection attempts when a pooled connection cannot be established on first try.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_RECONNECT_INTERVAL

Duration

PT1S

The hostname verification algorithm to use in case the server’s identity should be checked. Should be HTTPS, LDAPS or an empty string.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_HOSTNAME_VERIFICATION_ALGORITHM

string

The maximum time a connection remains unused in the pool before it is closed.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_IDLE_TIMEOUT

Duration

no timeout

Set to true to share the pool among datasources. There can be multiple shared pools distinguished by name, when no specific name is set, the __vertx.DEFAULT name is used.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_SHARED

boolean

false

Set the pool name, used when the pool is shared among datasources, otherwise ignored.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_NAME

string

Other unspecified properties to be passed through the Reactive SQL Client directly to the database when new connections are initiated.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_ADDITIONAL_PROPERTIES

Map<String,String>

Additional named datasources

类型

默认

If we create a Reactive datasource for this datasource.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE

boolean

true

Whether prepared statements should be cached on the client side.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_CACHE_PREPARED_STATEMENTS

boolean

false

The datasource URL.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_URL

string

The datasource pool maximum size.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_MAX_SIZE

int

When a new connection object is created, the pool assigns it an event loop. When #event-loop-size is set to a strictly positive value, the pool assigns as many event loops as specified, in a round-robin fashion. By default, the number of event loops configured or calculated by Quarkus is used. If #event-loop-size is set to zero or a negative value, the pool assigns the current event loop to the new connection.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_EVENT_LOOP_SIZE

int

Whether all server certificates should be trusted.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_TRUST_ALL

boolean

false

PEM Trust config is disabled by default.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_TRUST_CERTIFICATE_PEM

boolean

false

Comma-separated list of the trust certificate files (Pem format).

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_TRUST_CERTIFICATE_PEM_CERTS

list of string

JKS config is disabled by default.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_TRUST_CERTIFICATE_JKS

boolean

false

Path of the key file (JKS format).

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_TRUST_CERTIFICATE_JKS_PATH

string

Password of the key file.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_TRUST_CERTIFICATE_JKS_PASSWORD

string

PFX config is disabled by default.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_TRUST_CERTIFICATE_PFX

boolean

false

Path to the key file (PFX format).

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_TRUST_CERTIFICATE_PFX_PATH

string

Password of the key.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_TRUST_CERTIFICATE_PFX_PASSWORD

string

PEM Key/cert config is disabled by default.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_KEY_CERTIFICATE_PEM

boolean

false

Comma-separated list of the path to the key files (Pem format).

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_KEY_CERTIFICATE_PEM_KEYS

list of string

Comma-separated list of the path to the certificate files (Pem format).

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_KEY_CERTIFICATE_PEM_CERTS

list of string

JKS config is disabled by default.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_KEY_CERTIFICATE_JKS

boolean

false

Path of the key file (JKS format).

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_KEY_CERTIFICATE_JKS_PATH

string

Password of the key file.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_KEY_CERTIFICATE_JKS_PASSWORD

string

PFX config is disabled by default.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_KEY_CERTIFICATE_PFX

boolean

false

Path to the key file (PFX format).

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_KEY_CERTIFICATE_PFX_PATH

string

Password of the key.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_KEY_CERTIFICATE_PFX_PASSWORD

string

The number of reconnection attempts when a pooled connection cannot be established on first try.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_RECONNECT_ATTEMPTS

int

0

The interval between reconnection attempts when a pooled connection cannot be established on first try.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_RECONNECT_INTERVAL

Duration

PT1S

The hostname verification algorithm to use in case the server’s identity should be checked. Should be HTTPS, LDAPS or an empty string.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_HOSTNAME_VERIFICATION_ALGORITHM

string

The maximum time a connection remains unused in the pool before it is closed.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_IDLE_TIMEOUT

Duration

no timeout

Set to true to share the pool among datasources. There can be multiple shared pools distinguished by name, when no specific name is set, the __vertx.DEFAULT name is used.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_SHARED

boolean

false

Set the pool name, used when the pool is shared among datasources, otherwise ignored.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_NAME

string

Other unspecified properties to be passed through the Reactive SQL Client directly to the database when new connections are initiated.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_ADDITIONAL_PROPERTIES

Map<String,String>

About the Duration format

持续时间的格式使用标准的 java.time.Duration 格式您可以在 Duration#parse() javadoc 中了解更多信息。

您还可以提供以数字开头的持续时间值。 在这种情况下,如果该值仅包含一个数字,则转换器将该值视为秒。 否则,PT 会隐式添加到值的前面,以获得标准的 java.time.Duration 格式。

Reactive DB2 Configuration

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

类型

默认

Whether SSL/TLS is enabled.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_DB2_SSL

boolean

false

Additional named datasources

类型

默认

Whether SSL/TLS is enabled.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_DB2_SSL

boolean

false

Reactive MariaDB/MySQL Specific Configuration

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

类型

默认

Charset for connections.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_MYSQL_CHARSET

string

Collation for connections.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_MYSQL_COLLATION

string

Desired security state of the connection to the server. See MySQL Reference Manual.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_MYSQL_SSL_MODE

disabled, preferred, required, verify-ca, verify-identity

disabled

Additional named datasources

类型

默认

Charset for connections.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_MYSQL_CHARSET

string

Collation for connections.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_MYSQL_COLLATION

string

Desired security state of the connection to the server. See MySQL Reference Manual.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_MYSQL_SSL_MODE

disabled, preferred, required, verify-ca, verify-identity

disabled

Reactive Microsoft SQL Server Specific Configuration

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

类型

默认

The desired size (in bytes) for TDS packets.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_MSSQL_PACKET_SIZE

int

Whether SSL/TLS is enabled.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_MSSQL_SSL

boolean

false

Additional named datasources

类型

默认

The desired size (in bytes) for TDS packets.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_MSSQL_PACKET_SIZE

int

Whether SSL/TLS is enabled.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_MSSQL_SSL

boolean

false

Reactive Oracle Specific Configuration

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Additional named datasources

类型

默认

Reactive PostgreSQL Specific Configuration

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

类型

默认

The maximum number of inflight database commands that can be pipelined.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_POSTGRESQL_PIPELINING_LIMIT

int

SSL operating mode of the client. See Protection Provided in Different Modes.

Environment variable: QUARKUS_DATASOURCE_REACTIVE_POSTGRESQL_SSL_MODE

disable, allow, prefer, require, verify-ca, verify-full

disable

Additional named datasources

类型

默认

The maximum number of inflight database commands that can be pipelined.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_POSTGRESQL_PIPELINING_LIMIT

int

SSL operating mode of the client. See Protection Provided in Different Modes.

Environment variable: QUARKUS_DATASOURCE__DATASOURCE_NAME__REACTIVE_POSTGRESQL_SSL_MODE

disable, allow, prefer, require, verify-ca, verify-full

disable

Reactive Datasource URL Reference

DB2

db2://[user[:[password]]@]host[:port][/database][?<key1>=<value1>[&<key2>=<value2>]]

Example

db2://dbuser:secretpassword@database.server.com:50000/mydb

Currently, the client supports the following parameter keys:

  • host

  • port

  • user

  • password

  • database

Configuring parameters in connection URL will override the default properties.

Microsoft SQL Server

sqlserver://[user[:[password]]@]host[:port][/database][?<key1>=<value1>[&<key2>=<value2>]]

Example

sqlserver://dbuser:secretpassword@database.server.com:1433/mydb

Currently, the client supports the following parameter keys:

  • host

  • port

  • user

  • password

  • database

Configuring parameters in connection URL will override the default properties.

MySQL / MariaDB

mysql://[user[:[password]]@]host[:port][/database][?<key1>=<value1>[&<key2>=<value2>]]

Example

mysql://dbuser:secretpassword@database.server.com:3211/mydb

Currently, the client supports the following parameter keys (case-insensitive):

  • host

  • port

  • user

  • password

  • schema

  • socket

  • useAffectedRows

Configuring parameters in connection URL will override the default properties.

Oracle

EZConnect Format

oracle:thin:@[[protocol:]//]host[:port][/service_name][:server_mode][/instance_name][?connection properties]

Example

oracle:thin:@mydbhost1:5521/mydbservice?connect_timeout=10sec

TNS Alias Format

oracle:thin:@<alias_name>[?connection properties]

Example

oracle:thin:@prod_db?TNS_ADMIN=/work/tns/

PostgreSQL

postgresql://[user[:[password]]@]host[:port][/database][?<key1>=<value1>[&<key2>=<value2>]]

Example

postgresql://dbuser:secretpassword@database.server.com:5432/mydb

Currently, the client supports the following parameter keys:

  • host

  • port

  • user

  • password

  • dbname

  • sslmode

  • additional properties, including:

    • application_name

    • fallback_application_name

    • search_path

    • options

Configuring parameters in connection URL will override the default properties.