jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases 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 and Relational Databases
Bookmark "Control the loop of resultset.next( );" Watch "Control the loop of resultset.next( );" New topic

Control the loop of resultset.next( );

Hewa Naimanage Sumedha Amalka

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$]";
ResultSet rsxl = stmnt.getResultSet();

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

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( );
It's not a secret anymore!