Class.forName("com.mysql.jdbc.Driver");
String url="jdbc:mysql://localhost/bbs?user=root& password=root";
Connection conn=DriverManager.getConnection(url);
conn.setAutoCommit(false);
String sql="insert into article values(null,?,?,now(),0)";
PreparedStatement pstmt=conn.prepareStatement(sql);
//Statement stmt=conn.createStatement();
pstmt.setInt(1,id);
pstmt.setInt(2,rootid);
pstmt.executeUpdate();
conn.commit();
conn.setAutocommit(true);
//stmt.close();
pstmt.close();
conn.close();
_______________________________
session.setAttribute("admin","true");