'JDBC driver Exception issue is coming in keycloak service
I'm trying to configure my keycloak-18 running on helm-chart with external mysql database-8 version.
here is my helm chart file
values.yaml file
image:
repository: quay.io/keycloak/keycloak
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "18.0.0"
args: ["start-dev"
,"--log-console-color=true"
,"--db=mysql"
,"--db-username=****"
,"--db-password=*****"
,"--db-url=jdbc:mysql://194.148.0.57/keycloakblockchain"
]
deployment file
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args: {{ .Values.args }}
ERROR
2022-05-05 02:43:50,762 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: No suitable driver found for jdbc:mysql://194.148.0.57/keycloakblockchain
2022-05-05 02:43:38,765 WARN [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator] (JPA Startup Thread: keycloak-default) HHH000342: Could not obtain connection to query metadata: java.sql.SQLException: No suitable driver found for jdbc:mysql://194.148.0.57/keycloakblockchain
at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:191)
at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:352)
at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1126)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)```
Solution 1:[1]
Try removing the jdbc: and just use the mysql:/ instead
"--db-url=mysql://194.148.0.57/keycloakblockchain"
Solution 2:[2]
I had the same issue. Took me some time to notice that I had a typo in "KC_DB=mysql"
while building the production image.
If you used the Dockerfile from here: https://www.keycloak.org/server/containers
than you should just need to change the KC_DB
environment var to mysql.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Harsh Manvar |
Solution 2 | t00manysecrets |