<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.io.*"%> <%@ page import="java.sql.*"%> Insert title here <% try{ int no = Integer.parseInt(request.getParameter("no")); String name = request.getParameter("name"); String content = request.getParameter("content"); System.out.printf("%d, %s, %s\n",no,name,content); //오라클에 접속하기 위해서는 드라이버를 로드해야 한다. Class.forName("oracle.jdbc.driver.OracleDriver"); Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:xe", "HR", "1234"); if (conn == null) {System.out.println("DB접속에 실패");} else {System.out.println("DB접속 성공");} // 특정한 번호를 가진 이의 content의 내용과 이름을 수정하는 문장 String sql = "update message set name=?,content=? where no=?"; PreparedStatement pstmt = conn.prepareStatement(sql); // 물음표를 채워 넣는다. pstmt.setNString(1,name); pstmt.setNString(2,content); pstmt.setInt(3,no); int result = pstmt.executeUpdate(); System.out.println(result +"개가 수정되었습니다."); pstmt.close(); conn.close(); response.sendRedirect("list.jsp"); // 전체 테이블 조회해서 확인 } catch(Exception e){} finally{} %>