[keycloak-user] different datasource

Stian Thorgersen sthorger at redhat.com
Wed Jun 22 02:49:02 EDT 2016


It's not supported to have multiple datasources and the connection is
always shared between all JPA providers.

On 21 June 2016 at 15:38, Daniele Capasso Barbato <
daniele.capasso at dnshosting.it> wrote:

> 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
>
>
>
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160622/b5db6441/attachment.html 


More information about the keycloak-user mailing list