java - 打开 OrientDB 数据库时出错

标签 java orientdb tinkerpop

我在 try catch 我的数据库时遇到了 URL 问题。 这是代码:

TransactionalGraph graph = new OrientGraph("/home/danicroque/Escritorio/demoCroque", "admin", "admin");

这里是错误:

run:
may 20, 2016 2:49:46 AM com.orientechnologies.common.log.OLogManager log
INFORMACIÓN: OrientDB auto-config DISKCACHE=907MB (heap=846MB os=3.802MB disk=447.700MB)
Exception in thread "main" com.orientechnologies.orient.core.exception.ODatabaseException: Error on opening database '/home/danicroque/Escritorio/demoCroque'
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:204)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:168)
    at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:1818)
    at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:161)
    at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:102)
    at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:98)
    at com.tinkerpop.blueprints.impls.orient.OrientGraph.<init>(OrientGraph.java:103)
    at pruebatodook.PruebaTodoOk.run(PruebaTodoOk.java:23)
    at pruebatodook.PruebaTodoOk.main(PruebaTodoOk.java:16)
Caused by: com.orientechnologies.orient.core.exception.OConfigurationException: Error in database URL: the engine was not specified. Syntax is: <engine>:<db-type>:<db-name>[?<db-param>=<db-value>[&]]*. URL was: /home/danicroque/Escritorio/demoCroque
    at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:441)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:187)
    ... 8 more
may 20, 2016 2:49:46 AM com.orientechnologies.common.log.OLogManager log
INFORMACIÓN: OrientDB Engine shutdown complete
/home/danicroque/.cache/netbeans/8.1/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 1 second)

我正在尝试使用 Netbeans 在 Ubuntu 中运行此代码。数据库的名称是 demoCroque,URL 是 /home/Escritorio/demoCroque

我该如何解决这个问题?

最佳答案

看起来您的 URL 格式不正确。

参见此处:http://orientdb.com/docs/2.2/Console-Command-Connect.html

<database-url> Defines the URL of the database you want to connect to.
It uses the format <mode>:<path>

<mode> Defines the mode you want to use in connecting to the database.
It can be PLOCAL or REMOTE.

<path> Defines the path to the database.

尝试像这样作为您的 URL:

REMOTE:192.168.1.1/demoCroque

或者

PLOCAL:../home/Escritorio/demoCroque

编辑:出于测试的目的,请使用完整的文件路径,直到您知道它可以正常工作,例如:

PLOCAL:C:/projects/myproject/Escritorio/demoCroque

关于java - 打开 OrientDB 数据库时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37336421/

相关文章:

rest - 是否有一个图数据库可以自动为每个节点生成静态端点?

graph-databases - 我应该能够在 OrientDB 中的两条边和/或一条边和一个节点之间创建边吗?

java - 使用 Java/Scala 的远程 Gremlin 服务器图突变

c++ - Boost GraphML 格式

java - ifne 和 ifnonnull 有什么区别?

java - 为什么 javac 编译器不使用有关 varargs 歧义的警告来标记此代码?

java - 运行 google map api v2 时出错

Java序列化效率

java - Tomcat 7 上的 OrientDB JDBC 连接器池