Este contenido no está disponible en el idioma seleccionado.

Chapter 74. SQL


Perform SQL queries.

74.1. What’s inside

Please refer to the above links for usage and configuration details.

74.2. Maven coordinates

Create a new project with this extension on code.quarkus.redhat.com

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-sql</artifactId>
</dependency>
Copy to Clipboard Toggle word wrap

74.3. Additional Camel Quarkus configuration

74.3.1. Configuring a DataSource

This extension leverages Quarkus Agroal for DataSource support. Setting up a DataSource can be achieved via configuration properties.

quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=your-username
quarkus.datasource.password=your-password
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/your-database
quarkus.datasource.jdbc.max-size=16
Copy to Clipboard Toggle word wrap

The Camel SQL component will automatically resolve the DataSource bean from the registry. When configuring multiple datasources, you can specify which one is to be used on an SQL endpoint via the URI options datasource or dataSourceRef. Refer to the SQL component documentation for more details.

74.3.1.1. Zero configuration with Quarkus Dev Services

In dev and test mode you can take advantage of Configuration Free Databases. The Camel SQL component will be automatically configured to use a DataSource that points to a local containerized instance of the database matching the JDBC driver type that you have selected.

74.3.2. SQL scripts

When configuring sql or sql-stored endpoints to reference script files from the classpath, set the following configuration property to ensure that they are available in native mode.

quarkus.native.resources.includes = queries.sql, sql/*.sql
Copy to Clipboard Toggle word wrap

74.3.3. SQL aggregation repository in native mode

In order to use SQL aggregation repositories like JdbcAggregationRepository in native mode, you must enable native serialization support.

In addition, if your exchange bodies are custom types, they must be registered for serialization by annotating their class declaration with @RegisterForReflection(serialization = true).

Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2025 Red Hat