public ODatabaseDocumentTx getDatabase(final boolean iCreate, final boolean iOpen) {
    if (pool != null)
      return pool.acquire();

    final ODatabaseDocument db = new ODatabaseDocumentTx(url);
    if (properties != null) {
       properties.entrySet().forEach(e -> db.setProperty(e.getKey(), e.getValue()));
    }

    if (!db.getURL().startsWith("remote:") && !db.exists()) {
      if (iCreate)
        db.create();
      else if (iOpen)
        throw new ODatabaseException("Database '" + url + "' not found");
    } else if (iOpen)
      db.open(user, password);

    return (ODatabaseDocumentTx) db;
  }
public ODatabaseDocumentTx getDatabase(final boolean iCreate, final boolean iOpen) {
    if (pool != null)
      return pool.acquire();

    final ODatabaseDocument db = new ODatabaseDocumentTx(url);
    if (properties != null) {
       properties.entrySet().forEach(e -> db.setProperty(e.getKey(), e.getValue()));
    }

    if (!db.getURL().startsWith("remote:") && !db.exists()) {
      if (iCreate)
        db.create();
      else if (iOpen)
        throw new ODatabaseException("Database '" + url + "' not found");
    } else if (iOpen)
      db.open(user, password);

    return (ODatabaseDocumentTx) db;
  }
public ODatabaseDocumentTx getDatabase ( final boolean iCreate , final boolean iOpen ) { if ( pool != null ) return pool . acquire ( ) ; final ODatabaseDocument db = new ODatabaseDocumentTx ( url ) ; if ( properties != null ) { properties . entrySet ( ) . forEach ( e -> db . setProperty ( e . getKey ( ) , e . getValue ( ) ) ) ; } if ( ! db . getURL ( ) . startsWith ( "remote:" ) && ! db . exists ( ) ) { if ( iCreate ) db . create ( ) ; else if ( iOpen ) throw new ODatabaseException ( "Database '" + url + "' not found" ) ; } else if ( iOpen ) db . open ( user , password ) ; return ( ODatabaseDocumentTx ) db ; }
Gives new connection to database. If current factory configured to use pool (see {@link #setupPool(int, int)} method),
retrieves connection from pool. Otherwise creates new connection each time.

@param iCreate if true automatically creates database if database with given URL does not exist
@param iOpen   if true automatically opens the database

@return database
Gives new connection to database . If current factory configured to use pool ( see { @link #setupPool ( int int ) } method ) retrieves connection from pool . Otherwise creates new connection each time .