linux - 使用 Java API 插入数据后无法连接远程 orientdb

标签 linux database orientdb java

我知道有关于这个主题的问题,我在 Closing a "local" OrientDB when using connection pools 中找到了它. 但这并没有解决我的问题,即: 我有代码

OrientGraphFactory ogf = new OrientGraphFactory("plocal:/opt/orientdb/databases/sad", "admin", "admin");
    if(ogf.exists()){
        System.out.println("Database exist");
    }
    else
        System.out.println("Database NOT exist");

    OrientGraph og = ogf.getTx();
    Vertex vPerson = og.addVertex("class:My");
    vPerson.setProperty("city", "Almaty");
    vPerson.setProperty("city", "Astana");
    System.out.println(og.countVertices());
    OGlobalConfiguration.STORAGE_KEEP_OPEN.setValue( false );
    og.shutdown();
    ogf.close();

在此之后,当我尝试使用命令通过 console.sh 进行连接时

connect remote:localhost/sad root root

它无法连接到数据库,出现错误:

Error: com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage '/opt/orientdb/databases/sad' with mode=rw

Error: com.orientechnologies.orient.core.exception.OSerializationException: Cannot load database's configuration. The database seems to be corrupted.

我还在 orientdb-server-config.xml 中添加了接下来的两行:

<properties>
        <entry value="1" name="db.pool.min"/>
        <entry value="50" name="db.pool.max"/>
        <entry value="true" name="profiler.enabled"/>
        <entry value="info" name="log.console.level"/>
        <entry value="fine" name="log.file.level"/>
        + <entry name="cache.size" value="10000" />
        + <entry name="storage.keepOpen" value="false" />
    </properties>

请帮帮我

最佳答案

我用 2.2.12 版本试过你的代码,我只改变了我的路径

OrientGraphFactory ogf = new OrientGraphFactory("plocal:mypath/orientdb-community-2.2.12/databases/sad", "admin", "admin");

启动服务器后,我从控制台连接到数据库。

enter image description here

希望对您有所帮助。

关于linux - 使用 Java API 插入数据后无法连接远程 orientdb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40451658/

相关文章:

java - 查找两个节点之间的路径,而不提及要迭代的循环次数

c++ - 检查外部应用程序是否可用的最佳方法是什么?

mysql - 比较数据库表

javascript - SailsJS : Where to define db connection to not supported db type (orientdb)? 自定义中间件?

java - 将我的模型对象存储在房间数据库中的内容

sql - 如何使用键值对列表查询数据库

mysql - 银条东方数据库

c++ - 黄色检测程序断言失败

linux - 在父脚本中访问 shell 脚本返回的值

linux - selinux 阻止用户监听小于 32768 的端口(不,它大于 1024)