public final class DataSourceConfigHelper
extends java.lang.Object
AwsWrapperDataSource and AwsWrapperXADataSource). Resolves the final target JDBC
URL from either a configured JDBC URL or the server/port/database properties, and applies database
and credential overrides to props. The behavior mirrors the logic that previously lived
inline in AwsWrapperDataSource.getConnection() so both entry points resolve configuration
identically.| Modifier and Type | Method and Description |
|---|---|
static @Nullable java.lang.String |
removeWrapperPropertiesFromUrl(@Nullable java.lang.String url)
Returns
url with any AWS Wrapper-specific query parameters removed, keeping only
target-driver parameters. |
static java.lang.String |
resolveFinalUrl(java.util.Properties props,
java.lang.String protocolPrefix,
@Nullable java.lang.String jdbcUrl,
@Nullable java.lang.String serverName,
@Nullable java.lang.String serverPort,
@Nullable java.lang.String database,
@Nullable java.lang.String jdbcProtocol,
@Nullable java.lang.String user,
@Nullable java.lang.String password)
Resolves the final (non-wrapper) target URL and applies database/credential overrides to
props. |
public static java.lang.String resolveFinalUrl(java.util.Properties props,
java.lang.String protocolPrefix,
@Nullable java.lang.String jdbcUrl,
@Nullable java.lang.String serverName,
@Nullable java.lang.String serverPort,
@Nullable java.lang.String database,
@Nullable java.lang.String jdbcProtocol,
@Nullable java.lang.String user,
@Nullable java.lang.String password)
throws java.sql.SQLException
props.props - the connection properties to update in place.protocolPrefix - the wrapper protocol prefix to strip from a configured JDBC URL
(e.g. jdbc:aws-wrapper:).jdbcUrl - the configured JDBC URL, or null.serverName - the configured server name, or null.serverPort - the configured server port, or null.database - the configured database name, or null.jdbcProtocol - the configured JDBC protocol (required when jdbcUrl is not set).user - the user to apply, or null.password - the password to apply, or null.java.sql.SQLException - if neither a URL nor a server name is provided, or the protocol is missing.public static @Nullable java.lang.String removeWrapperPropertiesFromUrl(@Nullable java.lang.String url)
url with any AWS Wrapper-specific query parameters removed, keeping only
target-driver parameters. This prevents wrapper parameters (e.g. wrapperPlugins,
wrapperDialect, plugin-specific properties) from leaking into the URL handed to the
target driver, which some drivers reject as unknown parameters. Recognition uses the same
registry as PropertyDefinition.removeAll(Properties) (named and prefix-registered
wrapper properties), so it is only complete once the relevant plugin classes have been loaded.url - the URL to sanitize (may be null or have no query string).