wood burning stoves*
The moose likes JDBC and the fly likes Selecting n records from a table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Selecting n records from a table" Watch "Selecting n records from a table" New topic
Author

Selecting n records from a table

Ronald Whalen
Ranch Hand

Joined: Mar 27, 2001
Posts: 38
Hi,

Is there a way to select n number of records from a table.
thanks,
Ronald
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

from the documentation of java.sql.Statement:
"public void setMaxRows(int max)
throws SQLException
Sets the limit for the maximum number of rows that any ResultSet object can contain to the given number. If the limit is exceeded, the excess rows are silently dropped.
Parameters:
max - the new max rows limit; zero means unlimited"
...if your jdbc driver supports this method. If it doesn't you may have to hit your database documentation to find out what the database specific notation is for your database(if it has one).

Jamie

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Selecting n records from a table
 
Similar Threads
display first few records
accessing records
Fetching nK records in batch from client side?
If some records are deleted from table but still it is showing in front end than what will be....
delete duplicate records