2014-04-06 25 views
5

我创建了一个数据库出orientdb控制台Orientdb无法打开数据库:从Java

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

我启动服务器,以确保我的数据库创建成功。我打开 的webinterface:

localhost:2480 

而且我使用root用户和root作为密码登录到testdb中。一切 工作正常。但是,当我现在想从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) 

为什么他告诉我,用户名或密码是错误的,当它不是?

回答

6

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

所以使用:

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

起价OrientDB 1.7快照控制台只接受此类案件的网址:

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