Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve JDBC driver error message in Agroal processor #30751

Merged
merged 2 commits into from
Feb 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.stream.Collectors;

import javax.enterprise.inject.Default;
import javax.inject.Singleton;
Expand Down Expand Up @@ -344,14 +345,13 @@ private String resolveDriver(String dataSourceName, String dbKind,
}
}

throw new ConfigurationException("Unable to find a JDBC driver corresponding to the database kind '"
+ dbKind + "' for the "
+ (DataSourceUtil.isDefault(dataSourceName) ? "default datasource"
: "datasource '" + dataSourceName + "'")
+ ". Either provide a suitable JDBC driver extension, define the driver manually, or disable the JDBC datasource by adding "
+ (DataSourceUtil.isDefault(dataSourceName) ? "'quarkus.datasource.jdbc=false'"
: "'quarkus.datasource." + dataSourceName + ".jdbc=false'")
+ " to your configuration if you don't need it.");
throw new ConfigurationException(String.format(
"Unable to find a JDBC driver corresponding to the database kind '%s' for the %s (available: '%s'). "
gastaldi marked this conversation as resolved.
Show resolved Hide resolved
+ "Check if it's a typo, otherwise provide a suitable JDBC driver extension, define the driver manually, or disable the JDBC datasource by adding %s to your configuration if you don't need it.",
dbKind, DataSourceUtil.isDefault(dataSourceName) ? "default datasource" : "datasource '" + dataSourceName + "'",
jdbcDriverBuildItems.stream().map(JdbcDriverBuildItem::getDbKind).collect(Collectors.joining("','")),
DataSourceUtil.isDefault(dataSourceName) ? "'quarkus.datasource.jdbc=false'"
: "'quarkus.datasource." + dataSourceName + ".jdbc=false'"));
yrodiere marked this conversation as resolved.
Show resolved Hide resolved
}

@BuildStep
Expand Down