This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I am using a form to enter details into the Database. When I sub,it this form I am calling another JSP page. In that page I am connecting with DB and inserting the records into DB and later getting the records from DB and displaying.This thing is working good but what I need is ...the last data entered from the form should display at the end in my table when I am printing. Which is not the case that is happening. I can do a sort on the table but I dont have any ID no. I thought of having a sequence number for the table and as I insert my records increment the sequence number. So that when I print the data back I can sort on the sequnce number. Is this right???
Originally posted by Aditya Avula: I thought of having a sequence number for the table and as I insert my records increment the sequence number. So that when I print the data back I can sort on the sequnce number. Is this right???
Please help me out.
Sequence number, an insert date column, something like that is probably what you need.
Having the database do this means you can have more than one copy of your application updating the database at once. Otherwise you either need to coordinate your applications, or do locking in the database (which slows things down), or tolerate duplicates.
Once you have it, you can use an appropriate ORDER BY in your SELECT statement; the database will very often be able to sort faster than you can in Java. [ February 16, 2006: Message edited by: stu derby ]