public void closeInsert() throws KettleDatabaseException { if ( prepStatementInsert != null ) { try { prepStatementInsert.close(); prepStatementInsert = null; } catch ( SQLException e ) { throw new KettleDatabaseException( "Error closing insert prepared statement.", e ); } } }
public void closePreparedStatement( PreparedStatement ps ) throws KettleDatabaseException { if ( ps != null ) { try { ps.close(); } catch ( SQLException e ) { throw new KettleDatabaseException( "Error closing prepared statement", e ); } } }
public boolean absolute( ResultSet rs, int position ) throws KettleDatabaseException { try { return rs.absolute( position ); } catch ( SQLException e ) { throw new KettleDatabaseException( "Unable to move resultset to position " + position, e ); } }
public void closeUpdate() throws KettleDatabaseException { if ( prepStatementUpdate != null ) { try { prepStatementUpdate.close(); prepStatementUpdate = null; } catch ( SQLException e ) { throw new KettleDatabaseException( "Error closing update prepared statement.", e ); } } }
public void afterLast( ResultSet rs ) throws KettleDatabaseException { try { rs.afterLast(); } catch ( SQLException e ) { throw new KettleDatabaseException( "Unable to move resultset to after the last position", e ); } }
@Override public void registerException( LogChannelInterface log, Exception e, Class<?> packageClass, String key, String... parameters ) throws KettleDatabaseException { throw new KettleDatabaseException( BaseMessages.getString( packageClass, key, parameters ), e ); } }
public boolean relative( ResultSet rs, int rows ) throws KettleDatabaseException { try { return rs.relative( rows ); } catch ( SQLException e ) { throw new KettleDatabaseException( "Unable to move the resultset forward " + rows + " rows", e ); } }
public void rollback( Savepoint savepoint ) throws KettleDatabaseException { try { connection.rollback( savepoint ); } catch ( SQLException e ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Exception.UnableToRollbackToSavepoint" ), e ); } }
public Savepoint setSavepoint() throws KettleDatabaseException { try { return connection.setSavepoint(); } catch ( SQLException e ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Exception.UnableToSetSavepoint" ), e ); } }
public void releaseSavepoint( Savepoint savepoint ) throws KettleDatabaseException { try { connection.releaseSavepoint( savepoint ); } catch ( SQLException e ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Exception.UnableToReleaseSavepoint" ), e ); } }
public void clearBatch( PreparedStatement preparedStatement ) throws KettleDatabaseException { try { preparedStatement.clearBatch(); } catch ( SQLException e ) { throw new KettleDatabaseException( "Unable to clear batch for prepared statement", e ); } }
public void first( ResultSet rs ) throws KettleDatabaseException { try { rs.first(); } catch ( SQLException e ) { throw new KettleDatabaseException( "Unable to move resultset to the first position", e ); } }
public Savepoint setSavepoint( String savePointName ) throws KettleDatabaseException { try { return connection.setSavepoint( savePointName ); } catch ( SQLException e ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Exception.UnableToSetSavepointName", savePointName ), e ); } }
@Override public Object getValueFromResultSet( DatabaseInterface databaseInterface, ResultSet resultSet, int index ) throws KettleDatabaseException { try { return convertStringToInternetAddress( resultSet.getString( index + 1 ) ); } catch ( Exception e ) { throw new KettleDatabaseException( toStringMeta() + " : Unable to get Internet Address from resultset at index " + index, e ); } }
@Override public void setPreparedStatementValue( DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index, Object data ) throws KettleDatabaseException { try { preparedStatement.setObject( index, getString( data ), Types.OTHER ); } catch ( Exception e ) { throw new KettleDatabaseException( toStringMeta() + " : Unable to set Internet address value on prepared statement on index " + index, e ); } }
public void close() throws KettleDatabaseException { try { if ( result != null ) { result.close(); } if ( olapConnection != null ) { olapConnection.close(); } } catch ( Exception e ) { throw new KettleDatabaseException( "Error closing connection" ); } }
public void executeAndClearBatch( PreparedStatement preparedStatement ) throws KettleDatabaseException { try { if ( written > 0 && getDatabaseMetaData().supportsBatchUpdates() ) { preparedStatement.executeBatch(); } written = 0; preparedStatement.clearBatch(); } catch ( SQLException e ) { throw new KettleDatabaseException( "Unable to clear batch for prepared statement", e ); } }
public DatabaseFactoryInterface getDatabaseFactory() throws Exception { PluginRegistry registry = PluginRegistry.getInstance(); PluginInterface plugin = registry.getPlugin( DatabasePluginType.class, databaseInterface.getPluginId() ); if ( plugin == null ) { throw new KettleDatabaseException( "database type with plugin id [" + databaseInterface.getPluginId() + "] couldn't be found!" ); } ClassLoader loader = registry.getClassLoader( plugin ); Class<?> clazz = Class.forName( databaseInterface.getDatabaseFactoryName(), true, loader ); return (DatabaseFactoryInterface) clazz.newInstance(); }
public void truncateTable( String schema, String tablename ) throws KettleDatabaseException { if ( Utils.isEmpty( connectionGroup ) ) { String truncateStatement = databaseMeta.getTruncateTableStatement( schema, tablename ); if ( truncateStatement == null ) { throw new KettleDatabaseException( "Truncate table not supported by " + databaseMeta.getDatabaseInterface().getPluginName() ); } execStatement( truncateStatement ); } else { execStatement( "DELETE FROM " + databaseMeta.getQuotedSchemaTableCombination( schema, tablename ) ); } }
public void truncateTable( String tablename ) throws KettleDatabaseException { if ( Utils.isEmpty( connectionGroup ) ) { String truncateStatement = databaseMeta.getTruncateTableStatement( null, tablename ); if ( truncateStatement == null ) { throw new KettleDatabaseException( "Truncate table not supported by " + databaseMeta.getDatabaseInterface().getPluginName() ); } execStatement( truncateStatement ); } else { execStatement( "DELETE FROM " + databaseMeta.quoteField( tablename ) ); } }