public BankAccount getMainBankAccount() {
    if (!Constants.Banking) {
      return null;
    }
    Connection conn = null;
    ResultSet rs = null;
    PreparedStatement ps = null;
    BankAccount account = null;
    try
    {
      conn = iConomy.getiCoDatabase().getConnection();

      ps = conn.prepareStatement("SELECT * FROM " + Constants.SQLTable + "_BankRelations WHERE account_name = ? AND main = 1 LIMIT 1");
      ps.setString(1, this.name);
      rs = ps.executeQuery();

      if (rs.next()) {
        Bank bank = new Bank(rs.getInt("bank_id"));
        account = new BankAccount(bank.getName(), rs.getInt("bank_id"), this.name);
      }
    } catch (Exception e) {
      return null;
    }
    finally
    {
      if (ps != null) try {
          ps.close();
        } catch (SQLException ex) {
        } if (conn != null) try {
          conn.close();
        } catch (SQLException ex) {
        } 
    }
    return account;
  }