Statement vs PreparedStatement
·
CS/데이터베이스
깃헙 블로그에서 편하게 보기 Click! Statement 데이터베이스에 액세스 하는 데 사용된다. Statement 인터페이스는 매개 변수를 허용할 수 없으며 런타임에 정적 SQL문을 사용할 때 유용하다. SQL 쿼리를 한 번만 실행하려는 경우 Statement 인터페이스가 PreparedStatement보다 선호된다. Connection con = DriverManager.getConnection(); // Statement 객체 생성 Statement stmt = con.createStatement(); // Statement 실행 stmt.executeUpdate("CREATE TABLE STUDENT(ID NUMBER NOT NULL, NAME VARCHAR)"); PreparedStatemen..