PreparedStatement 변수 바인딩 시에 에러가 발생합니다.
sql = "select test_name from test_table where no = :no";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,"100");
rs = pstmt.executeQuery();
if(rs.next()) {
result = rs.getString(1);
}
이런 소스를 실행하면 아래와 같은 에러가 발생합니다.
cubrid.jdbc.driver.CUBRIDException: Semantic: Query yields no result, so variable 'no' is not set.
여기서 쿼리의 변수명을 "?"로 설정하면 잘 실행이 됩니다.
sql = "select test_name from test_table where no = ?";
이렇게하면 문제 없이 실행이 되거든요.
왜 변수 지정이 콜론 형식이면 안 되는지 궁금하네요.