Package liquibase.exception

Examples of liquibase.exception.DatabaseException



            oldFile.delete();
            newFile.renameTo(oldFile);
        } catch (Exception e) {
            throw new DatabaseException(e);
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException ignore) { }
View Full Code Here


            reader = null;

            oldFile.delete();
            newFile.renameTo(oldFile);
        } catch (Exception e) {
            throw new DatabaseException(e);
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException ignore) { }
View Full Code Here

    }

    @Override
    public void destroy() throws DatabaseException {
        if (changeLogFile.exists() && !changeLogFile.delete()) {
            throw new DatabaseException("Could not delete changelog history file "+changeLogFile.getAbsolutePath());
        }
    }
View Full Code Here




        } catch (SQLException e) {
            throw new DatabaseException(e);
        }
    }
View Full Code Here

     * @return the single result object
     */
    public static Object requiredSingleResult(Collection results) throws DatabaseException {
        int size = (results != null ? results.size() : 0);
        if (size == 0) {
            throw new DatabaseException("Empty result set, expected one row");
        }
        if (results.size() > 1) {
            throw new DatabaseException("Result set larger than one row");
        }
        return results.iterator().next();
    }
View Full Code Here

                getDatabase().dropDatabaseObjects(schema);
            }
        } catch (DatabaseException e) {
            throw e;
        } catch (Exception e) {
            throw new DatabaseException(e);
        } finally {
            try {
                LockServiceFactory.getInstance().getLockService(database).releaseLock();
            } catch (LockException e) {
                log.severe("Unable to release lock: " + e.getMessage());
View Full Code Here

        return createSnapshot(schemas, database, snapshotControl);
    }

    public DatabaseSnapshot createSnapshot(DatabaseObject[] examples, Database database, SnapshotControl snapshotControl) throws DatabaseException, InvalidExampleException {
        if (database.getConnection() instanceof OfflineConnection) {
            throw new DatabaseException("Cannot snapshot offline database");
        }
        return new JdbcDatabaseSnapshot(examples, database, snapshotControl);
    }
View Full Code Here

              i++;
          }
          // trigger execution
          stmt.execute();
      } catch(SQLException e) {
          throw new DatabaseException(e);
      } finally {
          for (Closeable closeable : closeables) {
                StreamUtil.closeQuietly(closeable);
            }
          JdbcUtils.closeStatement(stmt);
View Full Code Here

          stmt.setBinaryStream(i, lob.content, (int) lob.length);
        } else {
          stmt.setBinaryStream(i, lob.content, lob.length);
        }
      } catch (IOException e) {
        throw new DatabaseException(e.getMessage(), e); // wrap
      }
    } else if(col.getValueClobFile() != null) {
      try {
        LOBContent<Reader> lob = toCharacterStream(col.getValueClobFile(), col.getEncoding());
        if (lob.length <= Integer.MAX_VALUE) {
          stmt.setCharacterStream(i, lob.content, (int) lob.length);
        } else {
          stmt.setCharacterStream(i, lob.content, lob.length);
        }
      } catch (IOException e) {
        throw new DatabaseException(e.getMessage(), e); // wrap
      }
    } else {
      // NULL values might intentionally be set into a change, we must also add them to the prepared statement 
      stmt.setNull(i, java.sql.Types.NULL);
    }
View Full Code Here

    private LOBContent<InputStream> toBinaryStream(String valueLobFile) throws DatabaseException, IOException
  {
    InputStream in = getResourceAsStream(valueLobFile);
   
    if (in == null) {
      throw new DatabaseException("BLOB resource not found: " + valueLobFile);
    }
   
    try {
      if (in instanceof FileInputStream) {
        in = createStream(in);
View Full Code Here

TOP

Related Classes of liquibase.exception.DatabaseException

Copyright © 2018 www.massapicom. 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.