/** * Open a new database pool on a specific environment. * * @param environment the starting environment. * @param database the database name * @param user the database user for the current pool of databases. * @param password the password relative to the user name */ public ODatabasePool(OrientDB environment, String database, String user, String password) { this(environment, database, user, password, OrientDBConfig.defaultConfig()); }
/** * 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. * * @param environment the url for an environemnt, like "embedded:/the/environment/path/" or "remote:localhost" * @param database the database for the current url. * @param user the database user for the current pool of databases. * @param password the password relative to the user */ public ODatabasePool(String environment, String database, String user, String password) { this(environment, database, user, password, OrientDBConfig.defaultConfig()); }
/** * Open a new database pool from a url, useful in case the application access to only a database or do not manipulate databases. * * @param url the full url for a database, like "embedded:/full/path/to/database" or "remote:localhost/database" * @param user the database user for the current pool of databases. * @param password the password relative to the user */ public ODatabasePool(String url, String user, String password) { this(url, user, password, OrientDBConfig.defaultConfig()); }
/** * Create a new database if not exists * * @param database database name * @param type can be plocal or memory * * @return true if the database has been created, false if already exists */ public boolean createIfNotExists(String database, ODatabaseType type) { return createIfNotExists(database, type, OrientDBConfig.defaultConfig()); }
OrientDBDocumentCollectionManagerFactory(String host, String user, String password, String storageType) { this.host = host; this.user = user; this.password = password; this.storageType = ofNullable(storageType) .map(String::toUpperCase) .map(ODatabaseType::valueOf) .orElse(ODatabaseType.PLOCAL); this.orient = new OrientDB("remote:" + host, user, password, OrientDBConfig.defaultConfig()); }
public OrientGraphFactory() { this(new OrientDB("embedded:.", OrientDBConfig.defaultConfig()), "memory_" + System.currentTimeMillis(), ODatabaseType.MEMORY, ADMIN, ADMIN); this.shouldCloseOrientDB = true; }
/** * Open a database * * @param database the database to open * @param user username of a database user or a server user allowed to open the database * @param password related to the specified username * * @return the opened database */ public ODatabaseSession open(String database, String user, String password) { return open(database, user, password, OrientDBConfig.defaultConfig()); }
/** * Create a new database * * @param database database name * @param type can be plocal or memory */ public void create(String database, ODatabaseType type) { create(database, type, OrientDBConfig.defaultConfig()); }
protected OrientDBConfig solveConfig(OrientDBConfig config) { if (config != null) { config.setParent(this.configurations); return config; } else { OrientDBConfig cfg = OrientDBConfig.defaultConfig(); cfg.setParent(this.configurations); return cfg; } }
public OrientGraphFactory(String url, String user, String password) { this.user = user; this.password = password; this.labelAsClassName = true; initConnectionParameters(url); factory = new OrientDB(connectionURI, OrientDBConfig.defaultConfig()); shouldCloseOrientDB = true; }
public OrientJdbcConnection(final String jdbcdDUrl, final Properties info) { this.dbUrl = jdbcdDUrl.replace("jdbc:orient:", ""); this.info = info; readOnly = false; final String username = info.getProperty("user", "admin"); final String password = info.getProperty("password", "admin"); final String serverUsername = info.getProperty("serverUser", ""); final String serverPassword = info.getProperty("serverPassword", ""); OURLConnection connUrl = OURLHelper.parseNew(dbUrl); orientDB = new OrientDB(connUrl.getType() + ":" + connUrl.getPath(), serverUsername, serverPassword, OrientDBConfig.defaultConfig()); if (!serverUsername.isEmpty() && !serverPassword.isEmpty()) { orientDB.createIfNotExists(connUrl.getDbName(), connUrl.getDbType().orElse(ODatabaseType.MEMORY)); } database = orientDB.open(connUrl.getDbName(), username, password); orientDBisPrivate = true; status = ODatabase.STATUS.OPEN; }
public void reCreatePool() { close(); OrientDBConfig config = OrientDBConfig.defaultConfig(); config.getConfigurations().setValue(OGlobalConfiguration.DB_POOL_MAX, this.maxSize); this.pool = new ODatabasePool(this.orientdb, this.dbName, this.userName, this.password, config); }
/** * Creates a new batch insert procedure. It's intended to be used only for a single batch cycle (begin, create..., end) * * @param iDbURL * db connection URL (plocal:/your/db/path) * @param iUserName * db user name (use admin for new db) * @param iPassword * db password (use admin for new db) */ public OGraphBatchInsertBasic(String iDbURL, String iUserName, String iPassword) { this.fullUrl = iDbURL; // The URL we receive here is a full URL, including the database, like memory:mydb or plocal:/path/do/db // To deprecate ODatabaseDocumentTx, we need to separate the "url" from the database name this.dbUrlConnection = OURLHelper.parseNew(fullUrl); this.dbType = dbUrlConnection.getDbType().orElse(ODatabaseType.MEMORY); String dbGroupUrl = dbUrlConnection.getType() + ":" + dbUrlConnection.getPath(); this.userName = iUserName; this.password = iPassword; this.orientDB = new OrientDB(dbGroupUrl, userName, password, OrientDBConfig.defaultConfig()); }
this.configurations = configurations != null ? configurations : OrientDBConfig.defaultConfig();
@ConsoleCommand(aliases = { "use database" }, description = "Connect to a database or a remote Server instance", onlineHelp = "Console-Command-Connect") public void connect( @ConsoleParameter(name = "url", description = "The url of the remote server or the database to connect to in the format '<mode>:<path>'") String iURL, @ConsoleParameter(name = "user", description = "User name") String iUserName, @ConsoleParameter(name = "password", description = "User password", optional = true) String iUserPassword) throws IOException { disconnect(); if (iUserPassword == null) { message("Enter password: "); final BufferedReader br = new BufferedReader(new InputStreamReader(this.in)); iUserPassword = br.readLine(); message("\n"); } currentDatabaseUserName = iUserName; currentDatabaseUserPassword = iUserPassword; urlConnection = OURLHelper.parseNew(iURL); orientDB = new OrientDB(urlConnection.getType() + ":" + urlConnection.getPath(), iUserName, iUserPassword, OrientDBConfig.defaultConfig()); if (!"".equals(urlConnection.getDbName())) { // OPEN DB message("\nConnecting to database [" + iURL + "] with user '" + iUserName + "'..."); currentDatabase = (ODatabaseDocumentInternal) orientDB.open(urlConnection.getDbName(), iUserName, iUserPassword); currentDatabaseName = currentDatabase.getName(); } message("OK"); final ODocument distribCfg = getDistributedConfiguration(); if (distribCfg != null) listServers(); }