티스토리 뷰



Connection con = ConnectionFactory.getConnection();

String sql = "INSERT INTO tableName " +
					"(column_a, column_b, column_c, column_d) " +
					"VALUES(?, ?, ?, ?)";

PreparedStatement pstmt = con.prepareStatement(sql);

pstmt.setInt(1, 123);
pstmt.setInt(2, 456);
pstmt.setInt(3, 789);
pstmt.setString(4, "문자");

// 이 부분 에러!!
pstmt.executeUpdate(sql);




해결책 → pstmt.executeUpdate(sql);을 pstmt.executeUpdate();로 고쳐주자.



   물음표가 있는 쿼리문을 execute하려고 해서 발생한 에러였다.



댓글
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함