Search code examples
javaorientdb

OrientDB can't get graph instance using remote from java


I created a database named "testing" and started the server, but when I try to get a graph instance from it using 'remote' ...

OrientGraphFactory factory = new OrientGraphFactory("REMOTE:localhost:2424/testing", "admin", "admin");
OrientGraph txGraph = factory.getTx();  <--- THIS LINE

... it gives this error message:

Exception in thread "main" java.lang.UnsupportedOperationException: Cannot check the existance of a database in a remote server. Please use the console or the OServerAdmin class. at com.orientechnologies.orient.client.remote.OStorageRemote.exists(OStorageRemote.java:282) at com.orientechnologies.orient.client.remote.OStorageRemoteThread.exists(OStorageRemoteThread.java:170) at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.exists(ODatabaseDocumentTx.java:1160) at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:1902) at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.(OrientBaseGraph.java:181) at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.(OrientTransactionalGraph.java:102) at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.(OrientTransactionalGraph.java:98) at com.tinkerpop.blueprints.impls.orient.OrientGraph.(OrientGraph.java:77) at testing.testing.main(testing.java:202)

The OServerAdmin class doesn't provide any utility to get a graph instance as well.

Tested on OrientDB v2.1.9

Any idea how to resolve this?


Solution

  • If you want to open a DB in remote mode you have to use OServerAdmin class and then you can use OrientGraphFactory. I attached you an example.

    enter image description here