Click to See Complete Forum and Search --> : managing datebase update info
Phaelax
03-27-2005, 10:35 PM
I have a JTable filled with data from an SQL database. After a user has made changes to the data, they can hit the "update" button to upload the new changes to the actual database. I only want it to update the rows that the user has changed, to save time from rewriting monotonous data. What would be the best way of keeping track of which data to update?
Also, would anyone know how to retrieve a mysql database's column names? And also how to know which columns are involved in a query result? (in java, of course)
ractoc
03-28-2005, 06:43 AM
To keep track of which rows are updated and which aren't, add an ID to your row (make sure it is always unique). This way, you can identify each record in your JTable to the exact record in the database. You will just need to keep a list of all the IDs that have been updated. When the user presses the update button, you can just loop through that list and update every ID in there.
As to getting the actual names in the table. I know that Oracle keeps a seperate table with all the collumn names in it. I think mySQL does the same, but I'm not quite sure. You could check the mySQL website for thatone, since it's more a SQL question.
Phaelax
03-28-2005, 01:38 PM
That should be simple enough. I'm pretty sure I know it in SQL, but i think the user_table and others in mysql are called something else, as those aren't found.
devx.com
Copyright Internet.com Inc. All Rights Reserved