임은 자바 EE와 더비 작업, 난 내 결과 집합에서 데이터를 얻을 INT 및 문자열에 넣어하려고하지만 내게이 오류 준다 작동하지 않습니다는 결과 집합 오류가
은 java.sql.SQLException을 : 잘못된를 현재 커서 위치에 대한 작업. 당신은 결과 집합 next()
방법을 사용할 필요가
Connection conn = null;
Statement stmt = null;
ResultSet result = null;
Hotel hot = new Hotel();
try {
synchronized (dataSource) {
conn = dataSource.getConnection();
}
stmt = conn.createStatement();
String req = "SELECT * FROM hotel WHERE num = " + num;
result = stmt.executeQuery(req);
}
//result.next();
int xxnum = result.getInt(1);
String nom = result.getString("nom");
String villeV = result.getString("ville");
int etoilesV = result.getInt("etoiles");
String directeur = result.getString("directeur");
Hotel hol = new Hotel(num, nom, villeV, etoilesV, directeur);
result.close();
stmt.close();
return hol;
} catch (SQLException ex) {
throw new DAOException("probl�me r�cup�ration de la liste des hotels !!", ex);
} finally {
closeConnection(conn);
}