question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keycloak 17 Quarkus is not using db-schema parameter properly

See original GitHub issue

Describe the bug

I am trying to deploy Keycloak 17 Quarkus with MariaDb and schema name different from default ‘keycloak’.

I created database with name ‘db4keycloak’ and trying to start Keycloak.

 bin/kc.sh start-dev \
  --db mariadb \
  --db-url-host localhost \
  --db-username keycloak \
  --db-password mypwd \
  --db-schema db4keycloak

And getting error:

022-03-03 21:17:17,040 WARN [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator] (JPA Startup Thread: keycloak-default) HHH000342: Could not obtain connection to query metadata: java.sql.SQLSyntaxErrorException: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=45) Unknown database 'keycloak' Keycloak is still trying to connect to default database ‘keycloak’ in JdbcEnvironmentInitiator.

Version

17.0.0

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

  1. Install MariaDb
  2. Create database user ‘keycloak’ and database ‘db4keycloak’
create database db4keycloak;
GRANT ALL PRIVILEGES ON db4keycloak.* to keycloak@'%' IDENTIFIED BY 'mypwd'; 
GRANT ALL PRIVILEGES ON db4keycloak.* to keycloak@'localhost' IDENTIFIED BY 'mypwd';
flush privileges;
  1. Start Keycloak:
 bin/kc.sh start-dev \
  --db mariadb \
  --db-url-host localhost \
  --db-username keycloak \
  --db-password mypwd \
  --db-schema db4keycloak

You will see error message:

[org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator] (JPA Startup Thread: keycloak-default) HHH000342: Could not obtain connection to query metadata: java.sql.SQLSyntaxErrorException: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=50) Unknown database 'keycloak'

Anything else?

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
hc42commented, Mar 5, 2022

I would wait util the merge request is accepted / merged and then close it.

0reactions
DGuhrcommented, May 4, 2022

to wrap up from what I understood --db-url-database should be used as mysql/mariadb doesn’t have the schema concept and this issue and PR could be closed then. Feel free to re-open when I miss something 😃

note to future me: when we have the ability to show config based on a rule engine (“dependant”), we should remove the db-schema option at runtime when database == mariadb/mysql at buildtime.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keycloak 17.0.0 released
A new approach to documentation in form of server guides to help you install and configure Keycloak. Upgraded Quarkus to 2.7.0.Final.
Read more >
All configuration options - Quarkus
AWS Lambda Type Default AWS Lambda Common Type Default AWS Lambda Gateway REST API Type Default Agroal ‑ Database connection pool Type Default
Read more >
Can't run keycloak 17 on Quarkus with cross DC mode #10521
My next step was to run keycloak in another DC with different network. I tried to put jgroups configuration at the beginning cache.xml....
Read more >
unable to start keycloak server duo to mysql error - Stack ...
I'm getting errors trying to run keycloak/quarkus with MySQL. I tried to this with Keycloak versions 18 & 17, and tried it with...
Read more >
Keycloak Puppet module
If you use the SSSD user provider and SSSD related parameters, ... Define a Keycloak realm that uses username and not email for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found