谢谢大家了,帮忙一下。
我的dbTrans: /**
* executeUpdate操作,用于数据更新,主要是Update,Insert
* @param sql 查询字段
* @throws SQLException 捕捉错误
*/
public void executeUpdate(String sql) throws SQLException {
try {
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
stmt.executeUpdate(sql);
}
catch (SQLException ex) {
ex.printStackTrace();
System.out.println("dbTrans.executeUpdate:"+ex.getMessage());
throw ex;
}
} public int[] doBatch(String sql) throws SQLException {
int[] rowResult=null;
String a;
try{
stmt = conn.createStatement();
StringTokenizer st=new StringTokenizer(sql,";");
while (st.hasMoreElements()) {
a = st.nextToken();
stmt.addBatch(a);
}
rowResult=stmt.executeBatch();
}
catch (SQLException ex) {
ex.printStackTrace();
System.out.println("dbTrans.doBatch"+ex.getMessage());
throw ex;
}
return rowResult;
}
我的dbTrans: /**
* executeUpdate操作,用于数据更新,主要是Update,Insert
* @param sql 查询字段
* @throws SQLException 捕捉错误
*/
public void executeUpdate(String sql) throws SQLException {
try {
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
stmt.executeUpdate(sql);
}
catch (SQLException ex) {
ex.printStackTrace();
System.out.println("dbTrans.executeUpdate:"+ex.getMessage());
throw ex;
}
} public int[] doBatch(String sql) throws SQLException {
int[] rowResult=null;
String a;
try{
stmt = conn.createStatement();
StringTokenizer st=new StringTokenizer(sql,";");
while (st.hasMoreElements()) {
a = st.nextToken();
stmt.addBatch(a);
}
rowResult=stmt.executeBatch();
}
catch (SQLException ex) {
ex.printStackTrace();
System.out.println("dbTrans.doBatch"+ex.getMessage());
throw ex;
}
return rowResult;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货