Orientdb 无法从 Java 打开数据库 [英] Orientdb Cant open Database from Java

查看:45
本文介绍了Orientdb 无法从 Java 打开数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I created a database out of the orientdb console:

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

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

I started the server to make sure my database was created successfully. I opened the webinterface:

localhost:2480

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

And i logged in into testdb using root as user and root as password. Everything worked fine. But when i now want to connect to my database from 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)

为什么他告诉我用户名或密码错误,而实际上不是?

Why he is telling me that username or password is wrong when its not?

推荐答案

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

In "create database" command from the console, user and password are used only to authenticate against a remote database. With "plocal", "local" and "memory" URL the admin user is always "admin" with password "admin".

所以使用:

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

从 OrientDB 1.7-SNAPSHOT 开始,控制台只接受这种情况下的 URL:

Starting from OrientDB 1.7-SNAPSHOT the console accepts only the URL for such cases:

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

这篇关于Orientdb 无法从 Java 打开数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆