Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


i have 1000 records in resultset, how to get first 100
records from resultset, because resultset fetch all 1000
records at a time?

Answers were Sorted based on User's Feedback



i have 1000 records in resultset, how to get first 100 records from resultset, because resultset f..

Answer / sumit

The question is not pretty clear. However, before retriving the records from the database if you want to make sure you get only 100 records in one hit. U can use the following API after creating the statement object.

Statement.setFetchSize(100);

Is This Answer Correct ?    6 Yes 0 No

i have 1000 records in resultset, how to get first 100 records from resultset, because resultset f..

Answer / chandra

There is two ways to getting the limited records from the
DB.
1)we can use sql command :
set rowcount 100 select * from mytab.

2)Instead of set rowcount you can use setMaxRow(100) method.

Is This Answer Correct ?    4 Yes 0 No

i have 1000 records in resultset, how to get first 100 records from resultset, because resultset f..

Answer / dmk.java@gmail.com

query should be prepare like this


select * from tab_name where rownum <= 100

Is This Answer Correct ?    6 Yes 3 No

i have 1000 records in resultset, how to get first 100 records from resultset, because resultset f..

Answer / kuldeep raaj sharma

SELECT TOP 100 from MyTable;

Is This Answer Correct ?    7 Yes 4 No

i have 1000 records in resultset, how to get first 100 records from resultset, because resultset f..

Answer / sri

ResultSet.getRow() will give you the row number where the
resultset cursor is in , check for ResultSet.getRow()==100
and then break out of the loop

Is This Answer Correct ?    4 Yes 2 No

i have 1000 records in resultset, how to get first 100 records from resultset, because resultset f..

Answer / a kumar

If your intention is to dislay only 100 records to the
user, then better make the change the query to retrieve
first 100 recs. (like say fetch first 100 rows in Db2).

Is This Answer Correct ?    4 Yes 4 No

i have 1000 records in resultset, how to get first 100 records from resultset, because resultset f..

Answer / saket

GO ON LINK JAVATEACHER.CO.IN AFTER THAT CLICK JSP ,,,,THERE
IS AN EXAMPLE OF PAGINATION SHOW THAT EXAMPLE THAT IS
PERFECT EXAMPLE FOR U

Is This Answer Correct ?    1 Yes 1 No

i have 1000 records in resultset, how to get first 100 records from resultset, because resultset f..

Answer / ravi

the is a syntax in sql 'limit'....using this u can get
desired number of rows...

suppose database having 1000 rows..

query will be:

select * from table limit 100;

first 100 rcds will be selected...

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More JDBC Interview Questions

What does setautocommit do?

0 Answers  


wahts is mean by primary key and unique key?

7 Answers   Wipro,


can we define indexes on a foreign key? Explain pros and cons?

1 Answers  


What are the advantages of database connection pooling?

0 Answers  


How many types of JDBC Drivers are present and what are they?

0 Answers  


Diff bet.. Function and Trigger?

3 Answers   Logica CMG,


If iam using JDBC API, do I also have to use ODBC?

1 Answers  


What is the use of jdbc api?

0 Answers  


I have the choice of manipulating database data using a byte[] or a java.sql.blob. Which has best performance?

0 Answers  


Explain in detail about JDBC and its general features?

0 Answers  


Explain the different ways to register a driver?

2 Answers  


What is connection data?

0 Answers  


Categories