[keycloak-user] different datasource

Daniele Capasso Barbato daniele.capasso at dnshosting.it
Tue Jun 21 09:38:20 EDT 2016


Hi,

I want to use in the same keycloak, different datasource to store in 
different database the eventsStore, realm and user data.

I configure 3 different mysql connections KeycloakDS, KeycloakLocal and 
KeycloakRemote jndi source in standalone.xml for wildfly and it works 
correctly.

In the keycloak-server.json there are this line for definition

"eventsStore": {
         "provider": "jpa",
         "jpa": {
             "exclude-events": [ "REFRESH_TOKEN" ]
         }
     },

     "realm": {
         "provider": "jpa"
     },

     "user": {
         "provider": "jpa"
     },

and for connections


  "connectionsJpa": {
         "default": {
             "dataSource": "java:jboss/datasources/KeycloakDS",
             "databaseSchema": "update"
         } ,


     },


but how is possible specify a different connectionsJpa and use it for 
realm,user and eventsStore ?

I try to modify the jpa connections declaration like this

"connectionsJpa": {
         "default": {
             "dataSource": "java:jboss/datasources/KeycloakDS",
             "databaseSchema": "update"
         } ,
         "second": {
             "dataSource": "java:jboss/datasources/KeycloakLocal",
             "databaseSchema": "update"
         },
         "third": {
             "dataSource": "java:jboss/datasources/KeycloakRemote",
             "databaseSchema": "update"
         }

     },

and no errors appears but all data and table are created in KeycloakDS only.

How can I configure to use the second a jpa connection for "realm data" 
and  to use third  jpa connection for "users data" ?


Thank you very much


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160621/cc56802e/attachment-0001.html 


More information about the keycloak-user mailing list