0
PrepareStmt에 숫자를 전달하려고 시도하지만이 오류가 발생합니다. 나는 내 문제를 이해할 수 없다.왜 "java.sql.SQLException : 잘못된 열 인덱스"가 표시됩니까?
검색어 :
private static final String SQL_FIND_ALL_CALENDARS = "SELECT * FROM calendar WHERE idCall > '?';";
기능 :
다른 클래스 내 매개 변수에서private List<Calendar> findAll(Connection con) throws SQLException {
List<Calendar> calendar = new ArrayList<Calendar>();
PreparedStatement prsmt = null;
ResultSet rs = null;
try {
prsmt = con.prepareStatement(SQL_FIND_ALL_CALENDARS);
prsmt.setInt(1, TestOracleJDBC.idCall);
rs = prsmt.executeQuery();
while (rs.next()) {
Calendar calendar2 = extractCalendar(rs);
calendar.add(calendar2);
}
} catch (SQLException ex) {
ex.printStackTrace();
} finally {
rs.close();
prsmt.close();
}
return calendar;
}
:
public static int idCall = 1;
세 가지를한다 : (a) 귀하의'extractCalendar' 방법은 무엇입니까? 질문을 편집하여 포함 시키십시오. (b) 검색어에 세미콜론을 사용하지 마십시오. (c) 도움이되지 않는 경우 이유를 설명하십시오. 코드에서 수행하고자하는 작업과 현재 수행중인 작업을 설명하십시오. –