• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Control the loop of resultset.next( );

 
Hewa Naimanage Sumedha Amalka
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Try this. It should work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic