public void update() {
		Connection conn = null;
		PreparedStatement pstmt = null;
		
		try {
			Class.forName("com.mysql.jdbc.Driver");
			String url = "jdbc:mysql://localhost:3306/rock";
			conn = DriverManager.getConnection(url,"root","123456");
			String sql = "update emp2 set sal=999 where ename = ?";
			pstmt = conn.prepareStatement(sql);
			pstmt.setString(1, "rock2");
			int result = pstmt.executeUpdate();
			System.out.println(result);
			
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			//6、释放资源
			try {
				if(null !=pstmt) {						
					pstmt.close();
				}
				if(null !=conn) {						
					conn.close();
				}
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}