一段代碼這里
1 疑問為什么要設置 con.setAutoCommit(false);
這里設置為false或者true有什么區別?
pStmt=con.prepareStatement("INSERT INTO test.addressbook_table" +
"(name,phone,address)"+
" values(?,?,?)");
con.setAutoCommit(false); pStmt.setString(1,name);
pStmt.setString(2,phone);
pStmt.setString(3,address);
int j=pStmt.executeUpdate();
con.commit();
2 public static Vector search(String strSql)throws Exception{
Vector addressbookBeans=new Vector()這里Vector向量表示什么意思?
1 疑問為什么要設置 con.setAutoCommit(false);
這里設置為false或者true有什么區別?
pStmt=con.prepareStatement("INSERT INTO test.addressbook_table" +
"(name,phone,address)"+
" values(?,?,?)");
con.setAutoCommit(false); pStmt.setString(1,name);
pStmt.setString(2,phone);
pStmt.setString(3,address);
int j=pStmt.executeUpdate();
con.commit();
2 public static Vector search(String strSql)throws Exception{
Vector addressbookBeans=new Vector()這里Vector向量表示什么意思?
是设置数据库不要自动提交,这样做一般是为事务处理做准备
如果设置成true,那末比如说你执行完一条类似update,delete之类的语句后,数据库会自动提交
这样我们就没有办法做事务处理了2.是一个集合的类型,也叫容器,用来存放数据阿