public class ODatabasePool extends Object implements AutoCloseable
Example of usage with an OrientDB context:
OrientDB orientDb= new OrientDB("remote:localhost","root","password");
//...
ODatabasePool pool = new ODatabasePool(orientDb,"myDb","admin","adminpwd");
ODatabaseDocument session = pool.acquire();
//....
session.close();
pool.close();
orientDb.close();
Example of usage as simple access to a specific database without a context:
ODatabasePool pool = new ODatabasePool("remote:localhost/myDb","admin","adminpwd");
ODatabaseDocument session = pool.acquire();
//....
session.close();
pool.close();
Created by tglman on 08/02/17.
Constructor and Description |
---|
ODatabasePool(OrientDB environment,
String database,
String user,
String password)
Open a new database pool on a specific environment.
|
ODatabasePool(OrientDB environment,
String database,
String user,
String password,
OrientDBConfig configuration)
Open a new database pool on a specific environment, with a specific configuration for this
pool.
|
ODatabasePool(String url,
String user,
String password)
Open a new database pool from a url, useful in case the application access to only a database
or do not manipulate databases.
|
ODatabasePool(String url,
String user,
String password,
OrientDBConfig configuration)
Open a new database pool from a url and additional configuration, useful in case the
application access to only a database or do not manipulate databases.
|
ODatabasePool(String environment,
String database,
String user,
String password)
Open a new database pool from a environment and a database name, useful in case the application
access to only a database or do not manipulate databases.
|
ODatabasePool(String environment,
String database,
String user,
String password,
OrientDBConfig configuration)
Open a new database pool from a environment and a database name with a custom configuration,
useful in case the application access to only a database or do not manipulate databases.
|
Modifier and Type | Method and Description |
---|---|
ODatabaseSession |
acquire()
Acquire a session from the pool, if no session are available will wait until a session is
available or a timeout is reached
|
void |
close() |
boolean |
isClosed()
Check if database pool is closed
|
public ODatabasePool(OrientDB environment, String database, String user, String password)
environment
- the starting environment.database
- the database nameuser
- the database user for the current pool of databases.password
- the password relative to the user namepublic ODatabasePool(OrientDB environment, String database, String user, String password, OrientDBConfig configuration)
environment
- the starting environment.database
- the database nameuser
- the database user for the current pool of databases.password
- the password relative to the user nameconfiguration
- the configuration relative for the current pool.public ODatabasePool(String url, String user, String password)
url
- the full url for a database, like "embedded:/full/path/to/database" or
"remote:localhost/database"user
- the database user for the current pool of databases.password
- the password relative to the userpublic ODatabasePool(String url, String user, String password, OrientDBConfig configuration)
url
- the full url for a database, like "embedded:/full/path/to/database" or
"remote:localhost/database"user
- the database user for the current pool of databases.password
- the password relative to the userconfiguration
- the configuration relative to the current pool.public ODatabasePool(String environment, String database, String user, String password)
environment
- the url for an environemnt, like "embedded:/the/environment/path/" or
"remote:localhost"database
- the database for the current url.user
- the database user for the current pool of databases.password
- the password relative to the userpublic ODatabasePool(String environment, String database, String user, String password, OrientDBConfig configuration)
environment
- the url for an environemnt, like "embedded:/the/environment/path/" or
"remote:localhost"database
- the database for the current url.user
- the database user for the current pool of databases.password
- the password relative to the userconfiguration
- the configuration relative to the current pool.public ODatabaseSession acquire() throws OAcquireTimeoutException
OAcquireTimeoutException
- in case the timeout for waiting for a session is reached.public void close()
close
in interface AutoCloseable
public boolean isClosed()
Copyright © 2009–2020 OrientDB. All rights reserved.