Remove AUTO_SERVER H2 default JDBC property

This avoids problems if the hostname can't be resolved by InetAddress.getLocalHost()

Closes #26042

Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
Alexander Schwartz 2024-06-06 16:55:10 +02:00 committed by Alexander Schwartz
parent 24aa6e143d
commit 3bcb8787c8
2 changed files with 2 additions and 2 deletions

View file

@ -123,7 +123,7 @@ public final class Database {
if ("dev-file".equalsIgnoreCase(alias)) { if ("dev-file".equalsIgnoreCase(alias)) {
return addH2NonKeywords("jdbc:h2:file:${kc.home.dir:${kc.db-url-path:" + escapeReplacements(System.getProperty("user.home")) + "}}" + escapeReplacements(File.separator) + "${kc.data.dir:data}" return addH2NonKeywords("jdbc:h2:file:${kc.home.dir:${kc.db-url-path:" + escapeReplacements(System.getProperty("user.home")) + "}}" + escapeReplacements(File.separator) + "${kc.data.dir:data}"
+ escapeReplacements(File.separator) + "h2" + escapeReplacements(File.separator) + escapeReplacements(File.separator) + "h2" + escapeReplacements(File.separator)
+ "keycloakdb${kc.db-url-properties:;;AUTO_SERVER=TRUE}"); + "keycloakdb${kc.db-url-properties:}");
} }
return addH2NonKeywords("jdbc:h2:mem:keycloakdb${kc.db-url-properties:}"); return addH2NonKeywords("jdbc:h2:mem:keycloakdb${kc.db-url-properties:}");
} }

View file

@ -292,7 +292,7 @@ public class ConfigurationTest {
.toString() .toString()
.replaceFirst(isWindows() ? "file:///" : "file://", ""); .replaceFirst(isWindows() ? "file:///" : "file://", "");
assertEquals("jdbc:h2:file:" + userHomeUri + "data/h2/keycloakdb;;AUTO_SERVER=TRUE;NON_KEYWORDS=VALUE", config.getConfigValue("quarkus.datasource.jdbc.url").getValue()); assertEquals("jdbc:h2:file:" + userHomeUri + "data/h2/keycloakdb;NON_KEYWORDS=VALUE", config.getConfigValue("quarkus.datasource.jdbc.url").getValue());
ConfigArgsConfigSource.setCliArgs("--db=dev-mem"); ConfigArgsConfigSource.setCliArgs("--db=dev-mem");
config = createConfig(); config = createConfig();