问个很菜的问题,一般的sql语句可如下进行事务处理,是否可类似调用多个存储过程?在存储过程中不commit即可?谢谢大侠
PreparedStatement prepStmt = null;
int result = 0;
try{
                        
             // Get a context for the JNDI look up
         Context ctx = new InitialContext();
         // Look up myDataSource
         datasource = (DataSource) ctx.lookup(Constants.DS_JNDI_NAME);
             
             conn = datasource.getConnection();
                        conn.setAutoCommit(false);
                        
                        StringBuffer sql = new StringBuffer("......");
                    
                    
                    logger.info(sql.toString());
                    
                    
                    prepStmt= conn.prepareStatement(sql.toString());
                    prepStmt.executeUpdate();
                    
                    logger.warn("first update!");
                  StringBuffer sql2 = new StringBuffer("......");
                    
                    
                                                              prepStmt = conn.prepareStatement(sql2.toString());
                    prepStmt.executeUpdate();
                    
                    
                    
                    
             conn.commit();
             conn.setAutoCommit(true);
            
        } catch (Exception e) {
                try{
             conn.rollback();
             conn.setAutoCommit(true);
             result = -1;
            }catch (Exception ex){
             logger.warn(ex.toString());
             }
      } 
             finally {
            if (prepStmt != null){
             try {
                 prepStmt.close();
                 prepStmt = null;
             }
             catch (Exception ea) {}
            }
            try{
           closeConnection(conn);
            }catch(Exception ec){}
                    
              }
               return result;

}