File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Control the loop of resultset.next( ); Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Control the loop of resultset.next( );" Watch "Control the loop of resultset.next( );" New topic
Author

Control the loop of resultset.next( );

Hewa Naimanage Sumedha Amalka
Greenhorn

Joined: Oct 31, 2006
Posts: 19
Hai, guys
I am using the ODBC database (Excel Sheet) and i wanna get the records from it. My code is scucess but there is a problem in resultset.next() method.

The thing is it retrieving all the data including the none data fields, so finally it became a never ending loop.

pls help me to get the data rang's records

Statement stmnt = connexl.createStatement();
String query = "SELECT * FROM [IJTS$]";
stmnt.execute(query);
ResultSet rsxl = stmnt.getResultSet();

while(rsxl.next()) {
String excelname = rsxl.getString(1);
String excelcate = rsxl.getString(2);
System.out.print(rsxl.getString(1));
System.out.println(" "+rsxl.getString(2));
}
Thanks


SCJP 1.4 71%, SCWCD 1.5 84%, SCBCD 90%, SCMAD 98%
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502



Try this. It should work.


Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Control the loop of resultset.next( );
 
Similar Threads
problem adding Arrays to an ArrayList in a loop
get a limited no of records
ODBC - JDBC connection and Updating MY SQL
ODBC-JDBC connection and Looping
ODBC-JDBC connection