1.建立
Statement stm = connection.createStatement();
PreparedStatement pstm = connection.prepareStatement(sql);
2.执行
stm.execute(sql);
pstm.execute();
3.stm可以执行多条sql;pstm只能执行一条sql
4.使用pstm的环境
执行同构sql,用pstm效率高;
构成sql语句时需要外部的变量值,用pstm。
1.建立
Statement stm = connection.createStatement();
PreparedStatement pstm = connection.prepareStatement(sql);
2.执行
stm.execute(sql);
pstm.execute();
3.stm可以执行多条sql;pstm只能执行一条sql
4.使用pstm的环境
执行同构sql,用pstm效率高;
构成sql语句时需要外部的变量值,用pstm。