This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Restricting the rows fetched Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Restricting the rows fetched" Watch "Restricting the rows fetched" New topic

Restricting the rows fetched

bharat yadav

Joined: May 27, 2003
Posts: 1
Hello ,
I m using JDBC to connect to Sybase Adaptive IQ 12.4.3 server.I am trying to limit the size of rows fetched from a table which contains 12 lac records.After selecting the records I am writing them to a flat file using Export in sybase.
But my set rowcount statement is not showing any effect and whole of my 12 lac records are written into the file.The code i m using is as below:
boolean b=stmt.execute("select customer_key,month_key,service_key,status_key,comb
ined_revenue into #temporary from telco_facts ");
stmt.execute("set rowcount 100");
stmt.execute("SET TEMPORARY OPTION Temp_Extract_Name1='f:\\topRec.txt'");
stmt.execute("select * from telco_facts order by service_key");
If instead of exporting the data into flat file ,I select it into a resultset
set row count works.I m using JConnect 5.5 JDBC driver.
I also tried stmt.setFetchSize(100) but that also is not working.
Please suggest me how should I resolve this problem.
Is there any other way of restricting the no of rows selected at the server itself.
Thanks in advance.
It is sorta covered in the JavaRanch Style Guide.
subject: Restricting the rows fetched
It's not a secret anymore!