简体   繁体   中英

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?

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.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM