I have an interface containing a table, i need to link that table to the DB Table so that it will automatically reflect the changes done in the DB Table to the Interface table. i.e: if someone (manually or another WEB Application) updated the DB table i want the changes to appear on my interface automatically

Thanks in advance


I think you should to query the database to get the result set by using this query for example SELECT * FROM Table_Name WHERE Certain_Condition, you can omit the condition if you want.
After fetching the result set you need the pick each row in the result set and assign it to each row in the table object by using setValue(int row, int col), forgive I don't remember the actual name of this method, but you can search it across the documentation under table model object.

I hope this benefits you :)
Happy coding


Hello MxDev,
thank you for the quick reply but the thing is that my problem is not how the retrieve data from the DB table, its that after doing that i want my application to detect automatically if chenges have been made to the related data and reflect those changes in my app.

What you ask is rather difficult. In order to know when the table has been updated, you need to add triggers to your table.
Then write a PL/SQL function that executes when the "trigger" is triggered.

The rest are a bit blurry to me since I am not familiar with that kind of deep SQL coding.
I think the you can call java methods in your triggers in order to update your application. But how will you know that application is running in order to update it?

Does it have to be automatically? Can't you just have a button that reads again the DB table, whenever the user clicks it?
What are you trying to accomplish in general?

If this doesn't cover you, try the database/sql forum of this site

indeed Java Methods that allow me to update my application upon DB update is what i am looking for because i don't want to ask my application to check for updates every x minutes disregarding weather there are updates or not, its a big load on my server, if you can direct me where to look at in Java because im kinda lost while searching in JAVA.

thanks again


I think if you don't have a solid background in SQL in either databases MSSQL Server, or Oracle you can do this as follow after each insertion or update using the front end java table you must update the table by querying the DB again to reflect recent changes that's it.

If you worried about the work load on your server you could put this operation on a different thread :) !!!!!!!!!!!

Don't try to make the things too difficult on you, just follow the general rule which says "Make it work, and then make it faster", and also the first rule in programming "Come up with simple solution, because many developers come up with difficult ones"

I hope this benefits you, happy coding :)