[keycloak-user] SQL error while migrating from mongo to mysql on 3.1.0.Final

abhishek raghav abhi.raghav007 at gmail.com
Tue May 23 06:31:57 EDT 2017


I found the root cause,

Keycloak 2.x considers two client-roles for the same client as different
even if they have the same name but different case(one role with all upper
case and other lower case).
But in KC 3.x, you can not create two client roles with the same name even
if the case is different.

In my case, when i exported the realm from KC 2.x, there were 2 client
roles with same name with different case.

This has resolved in Keycloak 3.x, if i use mysql as a persistence store.

*- Best Regards*
   Abhishek Raghav







On Tue, May 23, 2017 at 1:27 AM, abhishek raghav <abhi.raghav007 at gmail.com>
wrote:

> Hi
>
>
>
> Since keycloak now don’t support mongo, We are trying to import the data
> from keycloak-2.2.1 (mongo) to keycloak 3.1.0.Final (mysql)
>
> .I did a Realm export in KC 2.2.1 using different files strategy and I got
> <realm>-realm.json file and then on KC 3.1.0.Final, I did a realm import
> through UI.
>
> As soon as I click on create button, I get an error pop up saying *realm
> already exists* message and on the console I see the below stacktrace.
>
>
> 2017-05-22 19:28:59,980 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper]
> KEYCLOAK 3.1.0-0.1 SQL Error: 1062, SQLState: 23000 2017-05-22 19:28:59,982
> ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] KEYCLOAK
> 3.1.0-0.1 Duplicate entry 'ABC-aPPName' for key
> 'UK_B71CJLBENV945RB6GCON438AT' 2017-05-22 19:28:59,983 INFO
> [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] KEYCLOAK
> 3.1.0-0.1 HHH000010: On release of batch it still contained JDBC statements
>
> Any suggestions on what possibly went wrong.
>
>
> Note: Migration is happening from KC 2.2.1 to KC 3.1.0.Final and RDBMS
> (Mongo to Mysql).
>
> Also, if i use just H2 (no mysql) on KC 3.1.0, i could port all the  data
> without any issues from KC 2.2.1
>
>
> Thanks in advance.
> -Abhishek
>
>


More information about the keycloak-user mailing list