Zero rows returned with JdbcOdbcDriver to MS Sql 2000

This code always returns 0 rows. There is plenty of data in the MS SQL 2000 Customers table.

package DBTests;

import javax.swing.*;

//import javax.sql.*;

import java.sql.*;

import java.io.*;

import java.lang.*;

public class DBTests {

public static void main(String[] args)

//throws SQLException, ClassNotFoundException

{

Connection con=null;

Statement s=null;

ResultSet rslt=null;

int Row = 0;

int Account = 0;

int to =0;

String CustName = null;

String sQuery = null;

try {

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con = DriverManager.getConnection("jdbc:odbc:ITS_Finance","x","y");

s=con.createStatement();

// s.setQueryTimeout(600);

to = s.getQueryTimeout();

sQuery="SELECT top 5 * from Customers ";

rslt = s.executeQuery(sQuery);

while ( !rslt.next ( ) ) {

Row = rslt.getRow();

Account = rslt.getInt("Account");

CustName = rslt.getString("Customer Name");

System.err.print(Row);

System.err.print(" ");

System.err.print(Account);

System.err.print(" ");

System.err.print(CustName);

System.err.println();

}

} catch(ClassNotFoundException e) {

System.err.print("ClassNotFoundException: ");

System.err.println(e.getMessage());

} catch(SQLException e) {

System.err.print("SQLException:Connection ");

System.err.println(e.getMessage());

};

System.err.print("All Done");

};

};

[1566 byte] By [ebassadora] at [2007-11-27 9:57:05]
# 1
>while ( !rslt.next ( ) ) {Whrong. It should bewhile ( rslt.next ( ) ) {
zhaoyha at 2007-7-13 0:27:21 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...