com.orientechnologies.orient.core.exception.OConfigurationException:服务器上未配置数据库'TEST'

时间:2018-04-19 18:43:01

标签: scala orientdb

我设置了Orient DB的分布式版本。问题是我无法使用Scala API创建数据库:

    <dependency>
        <groupId>com.orientechnologies</groupId>
        <artifactId>orientdb-graphdb</artifactId>
        <version>2.2.2</version>
    </dependency>

val uri: String = "remote:XXX.XX.XX.XX/database/TEST"
val username: String = "root"
val password: String = "123"
val factory: OrientGraphFactory = new OrientGraphFactory(uri,username,password)
val graph: OrientGraph = factory.getTx()

当我运行此代码时,我收到错误:

INFO: Registered the new available server 'XXX.XX.XX.XX:2424'
Exception in thread "main" com.orientechnologies.orient.core.exception.OConfigurationException: Database 'TEST' is not configured on server (home=/root/orientdb/databases/)

如果我转到DB的其中一个节点并运行./bin/console.sh,然后运行:

create database remote:XXX.XX.XX.XX/database/TEST root 123 memory

然后重新执行Scala代码,然后它可以正常工作:

Apr 19, 2018 6:37:14 PM com.orientechnologies.common.log.OLogManager log
INFO: Registered the new available server 'XXX.XX.XX.XX:2424'
Apr 19, 2018 6:37:14 PM com.orientechnologies.common.log.OLogManager log
INFO: Registered the new available server '192.168.0.14:2424'
Apr 19, 2018 6:37:14 PM com.orientechnologies.common.log.OLogManager log
INFO: Registered the new available server '192.168.0.17:2424'

我在Scala中做错了什么?是否可以使用Scala API创建数据库?

1 个答案:

答案 0 :(得分:1)

正如您在此页面中看到的那样:https://orientdb.com/docs/last/Programming-Language-Bindings.html OrientDB支持Scala。 内存存储是本地的,只有在JVM运行时才能持久存储。您是否可以尝试创建一个类型为plocal的数据库,然后再次运行您的代码? 如果您对存储有更多了解:https://orientdb.com/docs/last/Storages.html

希望它有所帮助。

此致