Orientdb无法从Java打开数据库

时间:2014-04-06 06:58:02

标签: orientdb tinkerpop

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

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

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

localhost:2480

我使用root作为用户并使用root作为密码登录testdb。一切 工作得很好。但是当我现在想要从Java-Code连接到我的数据库时:

    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)

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

1 个答案:

答案 0 :(得分:5)

在"创建数据库"来自控制台的命令,用户和密码仅用于对远程数据库进行身份验证。使用" plocal"," local"和"记忆"管理员用户的网址始终是" 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