예제 #1
0
  @Test
  public void multipleDatabasesSameThread() throws IOException {
    OGraphDatabase db1 = OGraphDatabasePool.global().acquire(DB_URL, "admin", "admin");
    ODocument doc1 = db1.createVertex();

    doc1.field("key", "value");
    doc1.save();
    db1.close();

    OGraphDatabase db2 = OGraphDatabasePool.global().acquire(DB_URL, "admin", "admin");

    ODocument doc2 = db2.createVertex();
    doc2.field("key", "value");
    doc2.save();
    db2.close();

    db1 = OGraphDatabasePool.global().acquire(DB_URL, "admin", "admin");

    final List<?> result =
        db1.query(
            new OSQLSynchQuery<ODocument>(
                "select out[weight=3].size() from V where out.size() > 0"));

    doc1 = db1.createVertex();
    doc1.field("newkey", "newvalue");
    doc1.save();
    db1.close();
  }
예제 #2
0
 public static OGraphDatabase open(String username, String password) {
   OGraphDatabase db =
       OGraphDatabasePool.global()
           .acquire("local:" + BBConfiguration.getDBDir(), username, password);
   HooksManager.registerAll(db);
   return db;
 }