01.JAVA/Java2009. 4. 6. 15:02
반응형

PreparedStatement 를 이용

<%@ page import = "java.sql.PreparedStatement" %>


<%

String query = "select ? from table_name where x = ?";

PreparedStatement pstmt = conn.prepareStatement(query);

pstmt.setString(1, value_1);

pstmt.setString(2, value_2);


pstmt.close();

>%



Statement를 이용

<%@ page import = "java.sql.Statement" %>


<%


String query = "select ? from table_name where x = ?";

Statement stmt = conn.createStatement();

stmt.executeUpdate(query);

stmt.close();

%>

Posted by 1010