Java library to visualize database table relationships
Does anyon开发者_如何学JAVAe know of a Java library that would assist in creating a GUI component to visualize the relationships between tables in an SQL database, similar to the Relationships pane in Access, or the Diagrams function in SQL Server Enterprise Manager.
The closest I have been able to discover is the Prefuse library, however I would need to extract the database structure and build the graph manually - is there a simpler way to do this?
Cheers.
I would probably use Visual Library. I like Prefuse as well, but Visual Library's api is more Swing like if you are a Swing developer. Another option is GraphViz which some people like. You would still have to extract the database structure yourself though this is fairly straight forward using jdbc.
yFiles is a commercial graph and visualization library for Java / .NET / Ajax / Flex / Android that has been used for the exact same use in the DbVisualizer (JDBC) SQL client (free & commercial version). GraphML files exported from yFiles (and yFiles based windows in DBVisualizer) can be edited / (re)formatted in the (free) yEd Graph editor.
Extracting the database structure through the JDBC metadata programmatically might look straightforward, but from experience I can say that there's a fair bit of difference between JDBC drivers/database platforms. Also, depending on database platform, details needed and authorization levels used the results yielded might differ.
(N.B. I have no affiliation to either product other than being a user of the free editions of yEd and DBVisualizer, and include them in this answer because using the combination of these programs can give a good preview on the library features needed for such a project, and can be used as comparison check for its results).
精彩评论