简体   繁体   English

OrientDB无法使用Java远程获取图实例

[英]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' ... 我创建了一个名为“ testing”的数据库并启动了服务器,但是当我尝试使用“ 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. 线程“主”中的异常java.lang.UnsupportedOperationException:无法检查远程服务器中数据库的存在。 Please use the console or the OServerAdmin class. 请使用控制台或OServerAdmin类。 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) 在com.orientechnologies.orient.client.remote.OStorageRemote.exists(OStorageRemote.java:282)在com.orientechnologies.orient.client.remote.OStorageRemoteThread.exists(OStorageRemoteThread.java:170)在com.orientechnologies.orient.core .db.document.ODatabaseDocumentTx.exists(ODatabaseDocumentTx.java:1160)位于com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:1902)位于com.tinkerpop.blueprints.impls.orient.OrientBaseGraph。( com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph。(OrientTransactionalGraph.java:102)处com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph。(OrientTransactionalGraph.java:98)处的OrientBaseGraph.java:181) .blueprints.impls.orient.OrientGraph。(OrientGraph.java:77)在testing.testing.main(testing.java:202)

The OServerAdmin class doesn't provide any utility to get a graph instance as well. OServerAdmin类也没有提供任何实用程序来获取图形实例。

Tested on OrientDB v2.1.9 在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. 如果要以远程模式打开数据库,则必须使用OServerAdmin类,然后可以使用OrientGraphFactory。 I attached you an example. 我附了一个例子。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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