orient db无法打开任何类型的图表

时间:2015-05-17 19:41:20

标签: orientdb

我是orient-db的新手,甚至试图打开一个简单的内存数据库也遇到了一个主要障碍。 这是我的两行代码(在java中)

OrientGraphFactory factory = new  
OrientGraphFactory("memory:test").setupPool(1,10);

    // EVERY TIME YOU NEED A GRAPH INSTANCE
    OrientGraph g = factory.getTx();
    try {

    } finally {
       g.shutdown();
    }

我收到以下错误:

Exception in thread "main" com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage 'test' with mode=rw
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:210)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:223)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.acquire(OPartitionedDatabasePool.java:287)
at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:163)
at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:78)
at com.tinkerpop.blueprints.impls.orient.OrientGraph.<init>(OrientGraph.java:128)
at com.tinkerpop.blueprints.impls.orient.OrientGraphFactory.getTx(OrientGraphFactory.java:74)

Caused by: com.orientechnologies.orient.core.exception.OStorageException:      
Cannot open the storage 'test' because it does not exist in path: test
at    

com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage   .open(OAbstractPaginatedStorage.java:154)
... 7 more

什么&#39;路径&#39;它在说什么?尝试打开一个简单的内存数据库时,路径是如何相关的?此外,我还尝试使用plocal:/ ..... ,,,我总是得到上述错误。

此致 Bhargav。

2 个答案:

答案 0 :(得分:2)

  1. 首先尝试创建数据库:

    OrientGraphNoTx graph = new OrientGraphNoTx(“memory:test”);

  2. 然后使用游泳池:

    OrientGraphFactory factory = new OrientGraphFactory(“memory:test”)。setupPool(1,10);

    您使用的是哪个db版本?

答案 1 :(得分:1)

仅在内存中创建的数据库需要首先创建,池不允许(在上一个快照中修复)。尝试从没有池的工厂中获取实例,例如:

OrientGraphFactory factory = newOrientGraphFactory("memory:test");
factory.getTx().shutdown(); // AUTO-CREATE THE GRAPH IF NOT EXISTS
factory.setupPool(1,10);

// EVERY TIME YOU NEED A GRAPH INSTANCE
OrientGraph g = factory.getTx();
try {

} finally {
   g.shutdown();
}