<div dir="ltr">It's not supported to have multiple datasources and the connection is always shared between all JPA providers.</div><div class="gmail_extra"><br><div class="gmail_quote">On 21 June 2016 at 15:38, Daniele Capasso Barbato <span dir="ltr"><<a href="mailto:daniele.capasso@dnshosting.it" target="_blank">daniele.capasso@dnshosting.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="IT" link="blue" vlink="#954F72"><div><p class="MsoNormal">Hi,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I want to use in the same keycloak, different datasource to store in <u></u><u></u></p><p class="MsoNormal">different database the eventsStore, realm and user data.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I configure 3 different mysql connections KeycloakDS, KeycloakLocal and <u></u><u></u></p><p class="MsoNormal">KeycloakRemote jndi source in standalone.xml for wildfly and it works <u></u><u></u></p><p class="MsoNormal">correctly.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">In the keycloak-server.json there are this line for definition<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">"eventsStore": {<u></u><u></u></p><p class="MsoNormal"> "provider": "jpa",<u></u><u></u></p><p class="MsoNormal"> "jpa": {<u></u><u></u></p><p class="MsoNormal"> "exclude-events": [ "REFRESH_TOKEN" ]<u></u><u></u></p><p class="MsoNormal"> }<u></u><u></u></p><p class="MsoNormal"> },<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"> "realm": {<u></u><u></u></p><p class="MsoNormal"> "provider": "jpa"<u></u><u></u></p><p class="MsoNormal"> },<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"> "user": {<u></u><u></u></p><p class="MsoNormal"> "provider": "jpa"<u></u><u></u></p><p class="MsoNormal"> },<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">and for connections<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"> "connectionsJpa": {<u></u><u></u></p><p class="MsoNormal"> "default": {<u></u><u></u></p><p class="MsoNormal"> "dataSource": "java:jboss/datasources/KeycloakDS",<u></u><u></u></p><p class="MsoNormal"> "databaseSchema": "update"<u></u><u></u></p><p class="MsoNormal"> } ,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"> },<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">but how is possible specify a different connectionsJpa and use it for <u></u><u></u></p><p class="MsoNormal">realm,user and eventsStore ?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I try to modify the jpa connections declaration like this<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">"connectionsJpa": {<u></u><u></u></p><p class="MsoNormal"> "default": {<u></u><u></u></p><p class="MsoNormal"> "dataSource": "java:jboss/datasources/KeycloakDS",<u></u><u></u></p><p class="MsoNormal"> "databaseSchema": "update"<u></u><u></u></p><p class="MsoNormal"> } ,<u></u><u></u></p><p class="MsoNormal"> "second": {<u></u><u></u></p><p class="MsoNormal"> "dataSource": "java:jboss/datasources/KeycloakLocal",<u></u><u></u></p><p class="MsoNormal"> "databaseSchema": "update"<u></u><u></u></p><p class="MsoNormal"> },<u></u><u></u></p><p class="MsoNormal"> "third": {<u></u><u></u></p><p class="MsoNormal"> "dataSource": "java:jboss/datasources/KeycloakRemote",<u></u><u></u></p><p class="MsoNormal"> "databaseSchema": "update"<u></u><u></u></p><p class="MsoNormal"> }<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"> },<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">and no errors appears but all data and table are created in KeycloakDS only.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">How can I configure to use the second a jpa connection for "realm data" <u></u><u></u></p><p class="MsoNormal">and to use third jpa connection for "users data" ?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Thank you very much<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><u></u> <u></u></span></p></div></div><br>_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br></blockquote></div><br></div>