Package java.sql

Examples of java.sql.Connection.rollback()


            return conn;
         }
         String str = "SQLException in query '" + command + "' : " + e;
         log.warning(str + ": sqlSTATE=" + e.getSQLState() + " we destroy the connection in case it's stale");
         // To be on the save side we always destroy the connection:
         if (connection == null && conn != null && !conn.getAutoCommit()) conn.rollback();
         erase(conn);
         conn = null;
         throw e;
      }
      catch (Throwable e) {
View Full Code Here


         if (e instanceof NullPointerException) {
            e.printStackTrace();
         }
         String str = "Unexpected exception in query '" + command + "' : " + e;
         log.severe(str + ": We destroy the connection in case it's stale");
         if (connection == null && conn != null && !conn.getAutoCommit()) conn.rollback();
         erase(conn);
         conn = null;
         throw new Exception(e);
      }
      finally {
View Full Code Here

            return conn;
         }
         String str = "SQLException in query '" + command + "' : " + e;
         log.warning(str + ": sqlSTATE=" + e.getSQLState() + " we destroy the connection in case it's stale");
         // To be on the save side we always destroy the connection:
         if (connection == null && conn != null && !conn.getAutoCommit()) conn.rollback();
         erase(conn);
         conn = null;
         throw e;
      }
      catch (Throwable e) {
View Full Code Here

         if (e instanceof NullPointerException) {
            e.printStackTrace();
         }
         String str = "Unexpected exception in query '" + command + "' : " + e;
         log.severe(str + ": We destroy the connection in case it's stale");
         if (connection == null && conn != null && !conn.getAutoCommit()) conn.rollback();
         erase(conn);
         conn = null;
         throw new Exception(e);
      }
      finally {
View Full Code Here

       }
      catch (Throwable ex) {
         success = false;
         try {
            if (!conn.getAutoCommit()) {
               conn.rollback(); // rollback the original request ...
            }
         }
         catch (Throwable ex1) {
            log.severe("error occured when trying to rollback after exception: reason: " + ex1.toString() + " original reason:" + ex.toString());
            ex.printStackTrace(); // original stack trace
View Full Code Here

              } catch (Exception xcpt) {
                iErrorCount++;
                if (DebugFile.trace) DebugFile.writeln("  "+xcpt.getClass().getName()+": at line "+String.valueOf(iLine)+" "+xcpt.getMessage());
                if (bRecoverable) {
                  if (DebugFile.trace) DebugFile.writeln("  Connection.rollback()");
                  try { oConn.rollback(); } catch (SQLException ignore) {}
                } // fi (bRecoverable)
                if (oBadWrtr!=null) {
                  oBadWrtr.write(xcpt.getClass().getName()+": at card "+oVCard.get("N")+" "+xcpt.getMessage()+"\r\n");
                } // fi
                if (oDiscardWrtr!=null) {
View Full Code Here

            oImplLoad.close();
            if (bRecoverable) {
            if (0==iErrorCount)
              oConn.commit();
            else
              oConn.rollback();
            }

            if (DebugFile.trace) DebugFile.writeln("Connection.close()");
            oConn.close();
        } catch (Exception xcpt) {
View Full Code Here

             try { if (null!=oDiscardWrtr) oDiscardWrtr.close(); } catch (Exception ignore) {}
             try { if (null!=oBadWrtr) oBadWrtr.close(); } catch (Exception ignore) {}
             try { if (null!=oInBuff) oInBuff.close(); } catch (Exception ignore) {}
             try { if (null!=oInStrm) oInStrm.close(); } catch (Exception ignore) {}
             try { oImplLoad.close(); } catch (Exception ignore) {}
             try { if (bRecoverable) oConn.rollback(); } catch (Exception ignore) {}
             try { oConn.close(); } catch (Exception ignore) {}
             throw new ImportExportException(xcpt.getClass().getName() + " " + xcpt.getMessage());
        }
    } else {
View Full Code Here

                  if (aLine.length!=iColFmtsCount) {
                    iErrorCount++;
                    if (DebugFile.trace) DebugFile.writeln("  Error: at line "+String.valueOf(iLine)+" has "+String.valueOf(aLine.length)+" columns but should have "+String.valueOf(iColFmtsCount));
                    if (bRecoverable) {
                      if (DebugFile.trace) DebugFile.writeln("  Connection.rollback()");
                      try { oConn.rollback(); } catch (SQLException ignore) {}
                    }
                    if (oBadWrtr!=null) {
                      oBadWrtr.write("Error: at line "+String.valueOf(iLine)+" has "+String.valueOf(aLine.length)+" columns but should have "+String.valueOf(iColFmtsCount)+"\r\n");
                      oBadWrtr.write(sLine+"\r\n");
                    }
View Full Code Here

                    } catch (NumberFormatException xcpt) {
                      iErrorCount++;
                      if (DebugFile.trace) DebugFile.writeln("  NumberFormatException: at line "+String.valueOf(iLine)+" "+xcpt.getMessage());
                      if (bRecoverable) {
                        if (DebugFile.trace) DebugFile.writeln("  Connection.rollback()");
                        try { oConn.rollback(); } catch (SQLException ignore) {}
                      } // fi (bRecoverable)
                      if (oBadWrtr!=null) {
                        oBadWrtr.write("NumberFormatException: at line "+String.valueOf(iLine)+" "+xcpt.getMessage()+"\r\n");
                        oBadWrtr.write(sLine+"\r\n");
                      } // fi
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.