This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • 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