Orientdb 无法从 Java 打开数据库

标签 orientdb tinkerpop

我从 orientdb 控制台创建了一个数据库:

create database plocal:/C:/Development/orientdb/databases/testdb root root plocal graph

我启动了服务器以确保我的数据库已成功创建。我打开了
网络界面:
localhost:2480

我使用 root 登录到 testdb作为用户和 root作为密码。一切
工作正常。但是当我现在想从 Java 代码连接到我的数据库时:
    OrientGraph graph = null;

    try {
        graph = new OrientGraph("plocal:C:/Development/orientdb/databases/testdb", "root", "root");

        System.out.println("success");
    } catch(OException e) {
        System.out.println("no success - " + e.getMessage());

        e.printStackTrace();
    } finally {
        if(graph != null) {
            graph.shutdown();
        }
    }

我收到以下异常:
Exception in thread "main" com.orientechnologies.orient.core.exception.OSecurityAccessException: User or password not  valid for database: 'testdb'
at com.orientechnologies.orient.core.metadata.security.OSecurityShared.authenticate(OSecurityShared.java:150)
at com.orientechnologies.orient.core.metadata.security.OSecurityProxy.authenticate(OSecurityProxy.java:83)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.open(ODatabaseRecordAbstract.java:128)
at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:49)
at com.orientechnologies.orient.core.db.graph.OGraphDatabase.open(OGraphDatabase.java:92)
at de.hof.iisys.relationExtraction.freebase.tinkerpop.DAO.openGraph(DAO.java:30)
at de.hof.iisys.relationExtraction.freebase.main.Main.main(Main.java:44)

为什么他告诉我用户名或密码错误但不是?

最佳答案

在控制台的“创建数据库”命令中,用户和密码仅用于对远程数据库进行身份验证。使用“plocal”、“local”和“memory” URL,管理员用户始终是“admin”,密码为“admin”。

所以使用:

graph = new OrientGraph("plocal:C:/Development/orientdb/databases/testdb", "admin", "admin");

从 OrientDB 1.7-SNAPSHOT 开始,控制台只接受这种情况下的 URL:
create database plocal:/C:/Development/orientdb/databases/testdb

关于Orientdb 无法从 Java 打开数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22890957/

相关文章:

database - 图数据库统计直接关系

mysql - OrientDB 变压器 'jdbc' 未找到

java - 图从单个顶点遍历到 N 个顶点

java - 为什么会出现 Invalid keywords : PROPERTY error in orientdb?

orientdb - 用于删除数据库(如果存在)并在 OrientDB 中创建新数据库的命令

java - 非事务性命令关闭 OrienttDB 中的数据库

java - ETL加载器抛出FileNotFoundException : error loading json file

灯泡对象初始化方法中 fget 参数的 Python 灯泡框架示例

java - Java中使用Neo4jGraph.open()或GraphFactory.open()访问远程Neo4j数据库

gremlin - 带有 id 的边已经存在 - Gremlin