Java Code Examples for org.pentaho.di.core.database.Database#getSchemas()

The following examples show how to use org.pentaho.di.core.database.Database#getSchemas() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JobEntryColumnsExistDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  if ( wSchemaname.isDisposed() ) {
    return;
  }
  DatabaseMeta databaseMeta = jobMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    database.shareVariablesWith( jobMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog = new EnterSelectionDialog( shell, schemas,
          BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Title", wConnection.getText() ),
          BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Message" ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchemaname.setText( Const.NVL( d.toString(), "" ) );
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Empty.Message" ) );
        mb.setText( BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Empty.Title" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages
        .getString( PKG, "System.Dialog.AvailableSchemas.ConnectionError" ), e );
    } finally {
      if ( database != null ) {
        database.disconnect();
        database = null;
      }
    }
  }
}
 
Example 2
Source File: JobEntryTableExistsDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  if ( wSchemaname.isDisposed() ) {
    return;
  }
  DatabaseMeta databaseMeta = jobMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    database.shareVariablesWith( jobMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog = new EnterSelectionDialog( shell, schemas,
          BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Title", wConnection.getText() ),
          BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Message" ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchemaname.setText( Const.NVL( d.toString(), "" ) );
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Empty.Message" ) );
        mb.setText( BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Empty.Title" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ),
        BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.ConnectionError" ), e );
    } finally {
      if ( database != null ) {
        database.disconnect();
        database = null;
      }
    }
  }
}
 
Example 3
Source File: DimensionLookupDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog =
          new EnterSelectionDialog( shell, schemas, BaseMessages.getString(
            PKG, "DimensionLookupDialog.AvailableSchemas.Title", wConnection.getText() ), BaseMessages
            .getString( PKG, "DimensionLookupDialog.AvailableSchemas.Message", wConnection.getText() ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchema.setText( Const.NVL( d, "" ) );
          setTableFieldCombo();
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "DimensionLookupDialog.NoSchema.Error" ) );
        mb.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.GetSchemas.Error" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages
        .getString( PKG, "DimensionLookupDialog.ErrorGettingSchemas" ), e );
    } finally {
      database.disconnect();
    }
  }
}
 
Example 4
Source File: InsertUpdateDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog =
          new EnterSelectionDialog( shell, schemas, BaseMessages.getString(
            PKG, "InsertUpDateDialog.AvailableSchemas.Title", wConnection.getText() ), BaseMessages
            .getString( PKG, "InsertUpDateDialog.AvailableSchemas.Message", wConnection.getText() ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchema.setText( Const.NVL( d, "" ) );
          setTableFieldCombo();
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "InsertUpDateDialog.NoSchema.Error" ) );
        mb.setText( BaseMessages.getString( PKG, "InsertUpDateDialog.GetSchemas.Error" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages
        .getString( PKG, "InsertUpDateDialog.ErrorGettingSchemas" ), e );
    } finally {
      database.disconnect();
    }
  }
}
 
Example 5
Source File: DatabaseLookupDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog =
          new EnterSelectionDialog( shell, schemas, BaseMessages.getString(
            PKG, "DatabaseLookupDialog.AvailableSchemas.Title", wConnection.getText() ), BaseMessages
            .getString( PKG, "DatabaseLookupDialog.AvailableSchemas.Message", wConnection.getText() ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchema.setText( Const.NVL( d, "" ) );
          setTableFieldCombo();
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "DatabaseLookupDialog.NoSchema.Error" ) );
        mb.setText( BaseMessages.getString( PKG, "DatabaseLookupDialog.GetSchemas.Error" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages
        .getString( PKG, "DatabaseLookupDialog.ErrorGettingSchemas" ), e );
    } finally {
      database.disconnect();
    }
  }
}
 
Example 6
Source File: TableOutputDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog =
          new EnterSelectionDialog( shell, schemas, BaseMessages.getString(
            PKG, "TableOutputDialog.AvailableSchemas.Title", wConnection.getText() ), BaseMessages
            .getString( PKG, "TableOutputDialog.AvailableSchemas.Message", wConnection.getText() ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchema.setText( Const.NVL( d, "" ) );
          setTableFieldCombo();
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "TableOutputDialog.NoSchema.Error" ) );
        mb.setText( BaseMessages.getString( PKG, "TableOutputDialog.GetSchemas.Error" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages
        .getString( PKG, "TableOutputDialog.ErrorGettingSchemas" ), e );
    } finally {
      database.disconnect();
    }
  }
}
 
Example 7
Source File: DeleteDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog =
          new EnterSelectionDialog( shell, schemas,
            BaseMessages.getString( PKG, "DeleteDialog.AvailableSchemas.Title", wConnection.getText() ),
            BaseMessages.getString( PKG, "DeleteDialog.AvailableSchemas.Message", wConnection.getText() ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchema.setText( Const.NVL( d, "" ) );
          setTableFieldCombo();
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "DeleteDialog.NoSchema.Error" ) );
        mb.setText( BaseMessages.getString( PKG, "DeleteDialog.GetSchemas.Error" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages
        .getString( PKG, "DeleteDialog.ErrorGettingSchemas" ), e );
    } finally {
      database.disconnect();
    }
  }
}
 
Example 8
Source File: UpdateDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog = new EnterSelectionDialog( shell, schemas,
          BaseMessages.getString( PKG, "UpdateDialog.AvailableSchemas.Title", wConnection.getText() ),
          BaseMessages.getString( PKG, "UpdateDialog.AvailableSchemas.Message", wConnection.getText() ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchema.setText( Const.NVL( d, "" ) );
          setTableFieldCombo();
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "UpdateDialog.NoSchema.Error" ) );
        mb.setText( BaseMessages.getString( PKG, "UpdateDialog.GetSchemas.Error" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell,
        BaseMessages.getString( PKG, "System.Dialog.Error.Title" ),
        BaseMessages.getString( PKG, "UpdateDialog.ErrorGettingSchemas" ), e );
    } finally {
      database.disconnect();
    }
  }
}
 
Example 9
Source File: SynchronizeAfterMergeDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog =
          new EnterSelectionDialog( shell, schemas, BaseMessages.getString(
            PKG, "SynchronizeAfterMergeDialog.AvailableSchemas.Title", wConnection.getText() ), BaseMessages
            .getString( PKG, "SynchronizeAfterMergeDialog.AvailableSchemas.Message", wConnection.getText() ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchema.setText( Const.NVL( d, "" ) );
          setTableFieldCombo();
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "SynchronizeAfterMergeDialog.NoSchema.Error" ) );
        mb.setText( BaseMessages.getString( PKG, "SynchronizeAfterMergeDialog.GetSchemas.Error" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages
        .getString( PKG, "SynchronizeAfterMergeDialog.ErrorGettingSchemas" ), e );
    } finally {
      database.disconnect();
    }
  }
}
 
Example 10
Source File: OraBulkLoaderDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog =
          new EnterSelectionDialog( shell, schemas, BaseMessages.getString(
            PKG, "OraBulkLoaderDialog.AvailableSchemas.Title", wConnection.getText() ), BaseMessages
            .getString( PKG, "OraBulkLoaderDialog.AvailableSchemas.Message", wConnection.getText() ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchema.setText( Const.NVL( d, "" ) );
          setTableFieldCombo();
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "OraBulkLoaderDialog.NoSchema.Error" ) );
        mb.setText( BaseMessages.getString( PKG, "OraBulkLoaderDialog.GetSchemas.Error" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages
        .getString( PKG, "OraBulkLoaderDialog.ErrorGettingSchemas" ), e );
    } finally {
      database.disconnect();
    }
  }
}
 
Example 11
Source File: TableExistsDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  if ( wSchemaname.isDisposed() ) {
    return;
  }
  DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    database.shareVariablesWith( transMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog =
          new EnterSelectionDialog( shell, schemas,
            BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Title", wConnection.getText() ),
            BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Message" ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchemaname.setText( Const.NVL( d.toString(), "" ) );
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Empty.Message" ) );
        mb.setText( BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Empty.Title" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages
        .getString( PKG, "System.Dialog.AvailableSchemas.ConnectionError" ), e );
    } finally {
      if ( database != null ) {
        database.disconnect();
        database = null;
      }
    }
  }
}
 
Example 12
Source File: CombinationLookupDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog =
          new EnterSelectionDialog( shell, schemas, BaseMessages.getString(
            PKG, "CombinationLookupDialog.AvailableSchemas.Title", wConnection.getText() ), BaseMessages
            .getString( PKG, "CombinationLookupDialog.AvailableSchemas.Message", wConnection.getText() ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchema.setText( Const.NVL( d, "" ) );
          setTableFieldCombo();
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "CombinationLookupDialog.NoSchema.Error" ) );
        mb.setText( BaseMessages.getString( PKG, "CombinationLookupDialog.GetSchemas.Error" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages
        .getString( PKG, "CombinationLookupDialog.ErrorGettingSchemas" ), e );
    } finally {
      database.disconnect();
    }
  }
}
 
Example 13
Source File: AddSequenceDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  if ( wSchema.isDisposed() ) {
    return;
  }
  DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog =
          new EnterSelectionDialog( shell, schemas,
            BaseMessages.getString( PKG, "AddSequenceDialog.SelectSequence.Title", wConnection.getText() ),
            BaseMessages.getString( PKG, "AddSequenceDialog.SelectSequence.Message" ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchema.setText( Const.NVL( d.toString(), "" ) );
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "AddSequenceDialog.NoSchema.Message" ) );
        mb.setText( BaseMessages.getString( PKG, "AddSequenceDialog.NoSchema.Title" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages
        .getString( PKG, "AddSequenceDialog.ErrorGettingSchemas" ), e );
    } finally {
      if ( database != null ) {
        database.disconnect();
        database = null;
      }
    }
  }
}
 
Example 14
Source File: ColumnExistsDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  if ( wSchemaname.isDisposed() ) {
    return;
  }
  DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    database.shareVariablesWith( transMeta );
    try {
      database.connect();
      String[] schemas = database.getSchemas();

      if ( null != schemas && schemas.length > 0 ) {
        schemas = Const.sortStrings( schemas );
        EnterSelectionDialog dialog =
            new EnterSelectionDialog( shell, schemas,
                BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Title", wConnection.getText() ),
                BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Message" ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchemaname.setText( Const.NVL( d.toString(), "" ) );
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Empty.Message" ) );
        mb.setText( BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Empty.Title" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ),
          BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.ConnectionError" ), e );
    } finally {
      if ( database != null ) {
        database.disconnect();
        database = null;
      }
    }
  }
}