【发布时间】:2015-05-09 18:17:42
【问题描述】:
我正在尝试使用 Java 在 OrientDB 中为图形数据库创建架构,但我有两个无法解决的问题。我正在使用这个例子http://orientdb.com/docs/last/Graph-Schema.html
- 当我使用这个代码时
OServerAdmin serverAdmin = new OServerAdmin("remote:localhost").connect("root", "1234");
serverAdmin.createDatabase("mydb", "graph", "plocal");
serverAdmin.close();
我收到以下错误:
java.lang.NoSuchMethodError: com.orientechnologies.common.concur.resource.OResourcePool.getAllResources()Ljava/util/Collection; 在 com.orienttechnologies.orient.client.r
它创建了数据库,但仅此而已,因为我得到了那个异常。
- 我可以改为从命令行创建数据库,然后使用 Java 创建架构,例如:
OrientGraph graph = new OrientGraph("remote:localhost/mydb", "root", "1234");
OrientVertexType userVType = graph.createVertexType("User");
userVType.createProperty("email", OType.STRING)
// ...
它工作正常,但是每次我运行程序时它都会尝试创建架构,并且我收到用户类已经存在等错误消息。所以我想知道如何检查数据库和架构是否已经存在或在 OrientDB 中使用 Java 创建模式的正确方法是什么?
【问题讨论】: