SQLException Data Not Found
843854Jan 5 2002 — edited Jan 8 2002Hi everyone,
I am having a problem retrieving data from a SQl Server 2000 database. Below is the code
try {
dbURLStr = "jdbc:odbc:db_gellassoc";
Connection con = DriverManager.getConnection (dbURLStr, "", "");
Statement stmt = con.createStatement();
sqlStr = "Select * from tb_jobclass order by SortOrder;";
ResultSet rs = stmt.executeQuery(sqlStr);
Vector vGroupedListings = new Vector();
String test;
while(rs.next()) {
vJobClasses.addElement(rs.getString("JobClass").trim());
System.out.println(rs.getString("JobClass").trim());
}
catch(SQLException ex) {
System.out.println("SQLException " + ex.toString();
}
On the second call to rs.getString("JobClass"), I get the SQLException data not found. Can you not call getString on the same column twice in the same row?
Is it a problem with the JDBC driver?
I have also written a little Visual Basic program to update and add new records to this database and it works just fine.
Any help would be greatly appreciated.
Thanks in advance,
Greg