我知道有关于这个主题的问题,我在 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");
启动服务器后,我从控制台连接到数据库。
希望对您有所帮助。
关于linux - 使用 Java API 插入数据后无法连接远程 orientdb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40451658/