Click to See Complete Forum and Search --> : Sorting rows -- MySQL --> JDBC --> JSP


Ethan
06-13-2001, 04:35 PM
I have a servlet that sends an SQL query via JDBC to a MySQL database. Here's the sequence of events:

1. It goes through the ResultSet from top to bottom, using the data in each row as constructor parameters to create an object.

2. It puts the object into an array and moves on to the next line.

3. A JavaServer Page accesses the array and displays the data in an HTML table, one row per row in the database. (The objects represent articles, by the way, with fields like "title", "publication_date", "author".)

Here's the problem: the SQL query contains an "ORDER BY" phrase, but in the final HTML, the articles are all out of order. If a query returns data in a certain order, does a ResultSet not maintain that order? Or, are the articles unordered for some other reason?

Thanks!

- e :confused: