aspose file tools*
The moose likes JDBC and the fly likes The result set behaviour Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "The result set behaviour" Watch "The result set behaviour" New topic
Author

The result set behaviour

Amit Tiwary
Greenhorn

Joined: Feb 13, 2003
Posts: 22
The result set I am using to fetch data from a table in MS-Access following the query "select * from fun",is fetching the recors but not sequentially from data base? How do I fix that?
Thanx in adv
Amit
Kirtikumar Puthran
Ranch Hand

Joined: Mar 04, 2003
Posts: 37
select * from fun",is fetching the recors but not sequentially from data base? How do I fix that?

What do you mean by sequential. If you have a primary key defined in the table 'fun', then the above query will return results in order of that primary key column as that column will be indexed.
Hope this helps.
Rgds,
Kirtikumar Puthran


Regards,<br />Kirti
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121

Hi Amit,
As Kirtikumar says, "what do you mean by sequentially?" If you mean that you want the result set of your query to be sorted, then as far as I know, no database (including MS Access) returns a sorted result set from a database query -- unless the query includes an ORDER BY clause.
In other words, in order to get a sorted result set back for your database query, it should be something like:

Although I haven't verified Kirtikumar's claim (and I would like to know if he has), I don't think he is correct.
Hope this helps you.
Good Luck,
Avi.
Kirtikumar Puthran
Ranch Hand

Joined: Mar 04, 2003
Posts: 37
Hi Avi,
In MS Access, when you open a database in Design View, there is a parameter known as "Indexed" for each column.
The values of this parameter are:
No(Default)
Yes(Duplicates OK)
Yes(No Duplicates)
If the above query from Amit has to return results in a sorted order, then the Indexed parameter of the column has to be YES.
Rgds,
Kirtikumar Puthran
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The result set behaviour
 
Similar Threads
How much data can a session bean hold?
Result Set method that returns all rows
Performance issue if I do not retrieve the rest of result set
how to know when server automatically invalidates session
Convert List to ResultSet?