code: public static void cleanWorkspaceData(WorkspaceEntry wsEntry) throws DBCleanException
     {
        SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
  
        Connection jdbcConn = getConnection(wsEntry);
        String dialect = resolveDialect(jdbcConn, wsEntry);
        boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE);
  
        try
        {
           jdbcConn.setAutoCommit(autoCommit);
  
           DBCleanerTool dbCleaner = getWorkspaceDBCleaner(jdbcConn, wsEntry);
           doClean(dbCleaner);
        }
        catch (SQLException e)
        {
           throw new DBCleanException(e);
        }
        finally
        {
           try
           {
              jdbcConn.close();
           }
           catch (SQLException e)
           {
              LOG.error("Can not close connection", e);
           }
        }
     }
docs: Cleans workspace data from database.
  
  @param wsEntry
  workspace configuration
  @throws DBCleanException