Search code examples
orientdb

orient db unable to open any kind of graph


I am new to orient-db and have run into a major block even trying to open a simple in memory database. Here is my two lines of code (in 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();
    }

I get the following error:

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

What 'path' is it talking about? How is a path even relevant when trying to open a simple in memory database? Furthermore I have also tried this with plocal:/..... ,,, and I always get the above error.

Regards, Bhargav.


Solution

  • Databases created as in-memory only needs to be created first and the pool didn't allow it (fixed in last snapshot). Try acquiring an instance from the factory without pool, like:

    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();
    }