Tutorial — Relational Data Browsing
In this article, navigate bidirectionally through the database by following foreign-key-based or user-defined relationships with Jailer.
Join the DZone community and get the full member experience.Join For Free
navigate bidirectionally through the database by following foreign-key-based or user-defined relationships with jailer.
the jailer tool can be found at:
you might also like: why you should use a relational database instead of nosql for your iot applications
1. connect with the databasestart the data browser (jailerdatabrowser.exe or jailerdatabrowser.bat on windows platform)
$ sh jailerdatabrowser.sh
a data model holds information about the tables in the database and all associations between them.
most of the information can be retrieved automatically by analyzing the database schema.
click on analyze database .
you will be asked for the database connection information.
create a new connection.
select the dbms you are using from the displayed list and fill out the following form:
finally, click on
. jailer finds seven tables and five associations:
two associations are still missing:
- an employee is classified into a salary grade depending on his salary
- employees may receive bonuses
the data model is now complete.
2. browse a tableselect the menu item "open table" from "file" and choose "employee" as the table you want to browse.
a table browser appears showing the rows of table employee.
3. browse related rowsselect the "children" item from the "related rows" drop-down menu and choose "employee on inverse-boss".
another table browser appears showing the subordinates of each employee (the inverse of the "boss" relationship).
4. generate sql-querywithin each table browser, a sql-query can be generated which selects exactly the browser's content.
essentially it's a join of all the tables in the navigation chain.
close the second "employee" browser, navigate from employee to project_participation, and from there to project.
choose "query builder" item from the "sql/query" menu in the "project" browser:
the query builder form lets you save the query into a file, copy it to the clipboard or even execute it.
choose "execute" to get a query-result browser:
within this query-result browser, you can edit the query anyway you want.
thanks for reading!
Published at DZone with permission of Ralf Wisser. See the original article here.
Opinions expressed by DZone contributors are their own.