private String getCatalog(Connection connection, String schema) throws SQLException {
    if (Strings.isNullOrEmpty(schema)) {
      return connection.getCatalog();
    }

    String name = connection.getMetaData().getDatabaseProductName().toLowerCase();

    for (String d : RDBMS_WITHOUT_SCHEMAS) {
      if (name.contains(d)) {
        return schema;
      }
    }

    return connection.getCatalog();
  }
private String getCatalog(Connection connection, String schema) throws SQLException {
    if (Strings.isNullOrEmpty(schema)) {
      return connection.getCatalog();
    }

    String name = connection.getMetaData().getDatabaseProductName().toLowerCase();

    for (String d : RDBMS_WITHOUT_SCHEMAS) {
      if (name.contains(d)) {
        return schema;
      }
    }

    return connection.getCatalog();
  }
private String getCatalog ( Connection connection , String schema ) throws SQLException { if ( Strings . isNullOrEmpty ( schema ) ) { return connection . getCatalog ( ) ; } String name = connection . getMetaData ( ) . getDatabaseProductName ( ) . toLowerCase ( ) ; for ( String d : RDBMS_WITHOUT_SCHEMAS ) { if ( name . contains ( d ) ) { return schema ; } } return connection . getCatalog ( ) ; }
Wrapper for {@link Connection#getCatalog()} to solve problems with RDBMs for which catalog and schema are the same
thing. For these RDBMs, it returns the schema name when it is not-null and not-empty; otherwise, it returns the
value of java.sql.Connection.getCatalog(). For other RDBMs, it returns always the value of
java.sql.Connection.getCatalog().

@param connection An open JDBC connection
@param schema The schema name we want to use
@return The current catalog or the schema name passed as argument
@throws SQLException
Wrapper for { @link Connection#getCatalog () } to solve problems with RDBMs for which catalog and schema are the same thing . For these RDBMs it returns the schema name when it is not - null and not - empty ; otherwise it returns the value of java . sql . Connection . getCatalog () . For other RDBMs it returns always the value of java . sql . Connection . getCatalog () .