0

我正在使用 OrientDB-3.1.2。我可以从浏览器连接 OrientDB,但从代码中它无法连接到 db。这是我的代码片段

private static OrientGraphFactory gFactory;
private OrientGraph graphDB;
gFactory = new OrientGraphFactory("remote:localhost:2480/<db-name>").setupPool(0, 40);
this.graphDB = gFactory.getTx();

所以这给了我一个例外——

ERROR Message:{Caused by: com.orientechnologies.orient.core.exception.OStorageException: Cannot create a connection to remote server address(es): [127.0.0.1:2480]
} Module:{} Summary:{}
2020-09-09 17:53:31,293 ERROR Message:{ DB name="<some-db-name>"
} Module:{} Summary:{}
2020-09-09 17:53:31,293 ERROR Message:{ at com.orientechnologies.orient.client.remote.OStorageRemote.openRemoteDatabase(OStorageRemote.java:1906)
} Module:{} Summary:{}
2020-09-09 17:53:31,293 ERROR Message:{ at com.orientechnologies.orient.client.remote.OStorageRemote.openRemoteDatabase(OStorageRemote.java:1750)
} Module:{} Summary:{}
2020-09-09 17:53:31,293 ERROR Message:{ at com.orientechnologies.orient.client.remote.OStorageRemote.open(OStorageRemote.java:570)
} Module:{} Summary:{}
2020-09-09 17:53:31,293 ERROR Message:{ at com.orientechnologies.orient.core.db.document.ODatabaseDocumentRemote.internalOpen(ODatabaseDocumentRemote.java:235)
} Module:{} Summary:{}
2020-09-09 17:53:31,293 ERROR Message:{ at com.orientechnologies.orient.core.db.OrientDBRemote.open(OrientDBRemote.java:110)
} Module:{} Summary:{}
2020-09-09 17:53:31,294 ERROR Message:{ ... 66 more

有人可以建议我,我在哪里做错了吗?

4

1 回答 1

0

您指向 2480,即 HTTP 端口,您可以在其中找到 Studio。

连接的地址应该是 2424,也就是二进制协议端口(如果它很忙,则分配另一个,但无论如何你都可以在服务器日志中看到它)

于 2020-09-09T14:05:23.000 回答