<div dir="ltr">hi, Christian:<div><br></div><div>Are you suggesting using two databases, one is MyKeycloakDS to store keycloak data, and the other MyApplicationDS to store my application data? Or you mean just use one database MyKeycloakDS to store both keycloak user data and my application data? You said you don&#39;t recommend mixing the keycloak tables with my own, then is it possible to create a connection between the User_Entity table in KeyCloak database, and the Post table in my own database? Not an database expert :)</div><div><br></div><div>Thank you.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 1, 2016 at 7:33 AM, Christian Hebert <span dir="ltr">&lt;<a href="mailto:christian_hebert@hotmail.com" target="_blank">christian_hebert@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div dir="ltr"><div>Hi Ling,</div><div><br></div><div>I wouldn&#39;t recommend mixing the keycloak tables with your own but here is how you could do it. First, you should store the keycloak data in your database instead of using the default H2 database. We are using Oracle in our organization. </div><div><br></div><div>To do so, you need to create a new datasource in your jboss server (I will not cover how to create this, assuming that you know how) that you will name, let&#39;s say &quot;java:jboss/datasources/<wbr>MyKeycloakDS&quot;.</div><div><br></div><div>In your keycloak-server.json file, change the datasource under &quot;connectionsJpa&quot; for this new datasource.On the startup, keycloak will create all the tables required. </div><div><br></div><div>Please note that your current data (realm, users, roles, ...) will not be there. You will start as a fresh installation of Keycloak.</div><div><br></div><div>From this point, the table you are looking for is &quot;USER_ENTITY&quot;.</div><div><br></div><div>Hope this can help you!</div><div><br></div><div>Christian</div><br><div><hr>From: <a href="mailto:lingvisa@gmail.com" target="_blank">lingvisa@gmail.com</a><br>Date: Wed, 31 Aug 2016 10:53:20 -0700<br>To: <a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a><br>Subject: [keycloak-user] How to integrate or make use of KeyCloak user        database in my own application?<div><div class="h5"><br><br><div dir="ltr">Hi, All:<div><br></div><div>So far I have been playing with KeyCloak and been able to set it up and running the customer-portal example successfully. Now I need to actually use it in my application, and I am not totally sure whether KeyCloak is the thing that I am looking for, but I believe my need is just a common use case and hopefully KeyCloak is the right software that I am looking for..</div><div><br></div><div>When a user comes to my website, he registers and makes a post. Both the post and the user information is stored into databases, and the link between the user and post, i.e. who made which post? So I have two tables in my database: Post(id, post) and User(id,name), and another table UserPost(PostID, UserID) to store linking information. This is all fine in my own database.</div><div><br></div><div>But now when KeyCloak comes into play, the user first registers in KeyCloak server and user information are stored in its own database there, which seems unrelated to the database (Post and User) in my application. I don&#39;t want to duplicate two User databases in two servers, right? Even if I can tolerate the duplication, how to make the connection between KeyCloak database and my application database? I am using JBoss, Hibernate/JPA in my application.</div><div><br></div><div>Maybe I am missing something in the way how to connect KeyCloak with my own application. Is there any tutorial or documentation that I can read? </div><div><br></div><div>Thank you.</div><div><br></div><div><br></div><div><br></div></div>
<br></div></div>______________________________<wbr>_________________
keycloak-user mailing list
<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/keycloak-user</a></div>                                               </div></div>
</blockquote></div><br></div>