I would like code to display ms access database dynamically in a jframe .
here is my database.[img]http://i.imgur.com/PtuGLnX.png?1[/img].I tried searching a lot but i think i need personal help in this area as this is a suppose to be dynamically updated Jframe.on the other hand i am open to suggestion to how to better display the database(considering the details IDE:eclipse luna for java ee,ms access 2010,my website is in .jsp file).thanks in advance.

Edited by amogh.max: spelling

2 Years
Discussion Span
Last Post by JamesCherrill

You can do this by using JDBC to read the data and a JTable to display it. It's a fairly common thing to do, so you'll find many examples and tutorials on the web - just Google JDBC and JTable together


Agree with James, read the data and add to a JTable dynamically, in terms of it updating dynaimcally while in use I guess you may need to set a timer or something, maybe a thread, and update at regular intervals so that even while the table is on screen it will update if the database changes.


The OP said "display", which may imply that its not an updatable view - in which case its a lot lot simpler to do!
To handle updates, rather than a timer, you can listen for update events in the JTable and save the changes as they happen. Alternatively, you may prefer the kind of user interface where the user edits the table, then presses OK to commit the update, in which case you just listen for the OK button.

Votes + Comments
These data are coming from a sensor,so the database is updated every second;how would i implement listen for update in that case.

I have the feeling I've seen this question before the last two days, yet my answer remains the same: why a JFrame? why not use your .jsp file for the UI part?


@stultuske would love to use .jsp as my UI but i dont know where to begin and my project guide suggested that i shoukd use Jframe,so i'm just following the instructions.And thanks JamesCherrill i found what i was looking for,even made it work.just need to lookup how i can implement the update/dynamic method so it becomes somoewhat realtime .

Edited by amogh.max: improved formatting


OK. I was talking about the user updating the database, so it's propbably not relevant here.
If the database is updated every second then maybe you have to use a timer to update the display every second, unless you can hook into the update code somehow to pass the new info directly to the display code

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.