Examples of ExternalDatabaseException


Examples of org.jitterbit.integration.server.db.ExternalDatabaseException

              success = true;
          } catch(SQLException ex){
            StringBuilder error = new StringBuilder(ex.getMessage());
            error.append("\n");
            error.append(DbUtils.reportSqlForErrorMessage(dbTarget.m_sql, dbTarget.m_params));
            throw new ExternalDatabaseException(error.toString(), ex);
          } catch(DbUtilsException ex) {
            dbTarget.writeLog(ex.getMessage());
              throw new ExternalDatabaseException(ex.getMessage(), ex);
          } catch(IOException ex) {
            dbTarget.writeLog(ex.getMessage());
                throw new ExternalDatabaseException(ex.getMessage(), ex);
            } finally {
                KongaIoUtils.close(targetDataFile);
                KongaIoUtils.close(reader);
            }
        }
View Full Code Here

Examples of org.jitterbit.integration.server.db.ExternalDatabaseException

            bSourceUpdate = mode==DbInsertMode.SOURCE_UPDATE;
            iRecord=0;
            statementCache = Maps.newHashMap();
            success = true;
        } catch (ServerDbException ex) {
            throw new ExternalDatabaseException(ex.getMessage(), ex);
        } finally {
            if (!success && targetConnection != null) {
                targetConnection.close();
            }
        }
View Full Code Here

Examples of org.jitterbit.integration.server.db.ExternalDatabaseException

            String subprotocol = driver.getSubprotocol();
      writeLog("subprotocol=", subprotocol);
            return subprotocol;
        } catch (ServerConfigurationException ex) {
          writeLog(ex.toString());
            throw new ExternalDatabaseException(ex.getMessage(), ex);
        }
  }
View Full Code Here

Examples of org.jitterbit.integration.server.db.ExternalDatabaseException

      if(!bSourceUpdate && column.isForeignKey()){
        value=column.getForeignKeyValue();
        if(value==null){
          final String err="at line "+iRecord+", Find FK link fail, the corresponding PK value is missing";
          writeLog(err);
          throw new ExternalDatabaseException(err);
        }
      }
      column.setValue(value);
      i++;
    }
    if(nValues>i){
      final String err="at line "+iRecord+", load columns for table \""+table.getDisplayName()+
        "\" failed, number of columns is ("+Integer.toString(i)+
        ") < number of values ("+Integer.toString(nValues-1)+")";
      writeLog(err);
      throw new ExternalDatabaseException(err);
    }
  }
View Full Code Here

Examples of org.jitterbit.integration.server.db.ExternalDatabaseException

            sqlWhere=whereClause.toString();
            if(whereParams.size()>0){
              updateParams.addAll(whereParams);
            }
            if(setClause.length()==0){
              throw new ExternalDatabaseException("Source update error: the SET clause is empty.\nUpdate statement is \""+sqlUpdate+"\"");
            }
            if(whereClause.length()==0){
              throw new ExternalDatabaseException("Source update error: the WHERE clause is empty.\nUpdate statement is \""+sqlUpdate+"\"");
            }
        }
View Full Code Here

Examples of org.jitterbit.integration.server.db.ExternalDatabaseException

                writer=BackendEncoding.openFileForWriting(new File(params.dataFile));
                dbSource.writeLog("Writing database image to " + params.dataFile);
                dbSource.dumpSourceDataTree(root, params.adHocFilter, writer);
            } catch (IOException ex) {
              dbSource.writeLog(ex.getMessage());
                throw new ExternalDatabaseException(ex.getMessage(), ex);
            } finally {
                dbSource.doCleanup();
            }
        } catch (SQLException e) {
            throw new ExternalDatabaseException(e.getMessage(), e);
        } finally {
            closeDataFileWriter(writer);
        }
  }
View Full Code Here

Examples of org.jitterbit.integration.server.db.ExternalDatabaseException

    private static void closeDataFileWriter(Writer writer) throws ExternalDatabaseException {
        if (writer != null) {
            try {
                writer.close();
            } catch (IOException e) {
                throw new ExternalDatabaseException("The file with the source data read from the " +
                    "database could not be written to disk. This may indicate a problem with file " +
                    "permissions on the jitterbit server. Please contact Jitterbit support.", e);
            }
        }
    }
View Full Code Here

Examples of org.jitterbit.integration.server.db.ExternalDatabaseException

            } else {
                commitBeforeClose = false;
            }
            writeLog("Connected to " + sourceConnection.toString());
        } catch (ServerDbException ex) {
            throw new ExternalDatabaseException(ex.getMessage(), ex);
        } catch (SQLException ex) {
            throw new ExternalDatabaseException(ex.getMessage(), ex);
        }
    }
View Full Code Here

Examples of org.jitterbit.integration.server.db.ExternalDatabaseException

  {
    CROM rootTable=root.getChild(0);
    if(rootTable==null){
      String err="No root table in the source.";
      if(debug_log!=null)writeLog(err);
      throw new ExternalDatabaseException(err);
    }
    populateChildTablesMap(rootTable);

    if(StringUtils.isNotEmpty(adHocFilter)){
      modifyRootTableFilter(rootTable, adHocFilter);
    }

    try {
        boolean isFlat=root.isFlat();
      for(CROM table: root.getChildren()){
        if(table.isElementNode()){
            List<CROM> childTables = childTablesMap.get(table);
          sql = buildSqlForTable(table);
          int nField0=nField;
          if(debug_log!=null)writeLog("SQL for table \"" + table.getName() + "\": " + sql);
          PreparedStatement stmt = null;
          boolean statementMustBeClosedByMe = true;
          ResultSet rs = null;
          try {
              PreparedStatementCache statementCache = getStatementCacheForTable(table);
              stmt = statementCache.getPreparedStatement(sql);
              statementMustBeClosedByMe = statementCache.mustLastReturnedStatementBeClosedByCaller();
            if(debug_log!=null)writeLog("About to execute query.");
              rs = stmt.executeQuery();
            if(debug_log!=null)writeLog("Done executing query.");
              int numRecordOfParent=0;
              while(rs.next()){
                Record record = createRowRecord(table, nField0, rs);
                  if(debug_log!=null)writeLog("ADD - "+record.toString());
                numRecordOfParent++;
                if(debug_log!=null)writeLog(String.format("%8d rows of table %s added to the parent table %s\n", numRecordOfParent, table.getName(), root.getName()));
                if (!childTables.isEmpty()) {
                                // Note that elements may be removed from the records list by
                    // createSourceTreeForTable
                              List<Record>records = Lists.newArrayList(record);
                    createSourceTreeForTable(table, childTables, records);
                    checkInnerJoin(records);
                    if(records.size()==0)continue;
                }
              // this records contains one or zero record
              record.writeToText(writer, isFlat);
              }
          }
          finally {
            KongaDbUtils.close(rs);
            if (statementMustBeClosedByMe) {
                KongaDbUtils.close(stmt);
            }
          }
        }
      }
    }
    catch (SQLException e) {
      String err="SQL:"+sql+"\n"+e.getMessage();
      writeLog(err);
      throw new ExternalDatabaseException(err);
    }
  }
View Full Code Here

Examples of org.jitterbit.integration.server.db.ExternalDatabaseException

        try {
            SqlStatementParser parser = new SqlStatementParser(manualSql);
            String newSql = parser.replaceFilter(adHocFilter);
            ((CROM_DB) rootTable.getExtension()).setManualSqlStatement(newSql);
        } catch (Exception ex) {
            throw new ExternalDatabaseException("Jitterbit could not modify the manual SQL statement by adding " +
                    "the filter \"" + adHocFilter + "\". This is a bug. Please report it to Jitterbit Support.", ex);
        }
    }
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.