使用Community Edition v2.1.11
我编写了一个简单的数据同步器,它从MS-SQL DB获取数据,并将其与我在OrientDB图中的数据同步。
更新可能相当庞大,图表应每20分钟更新一次,因此我更喜欢使用本地模式;此外,其他应用程序应该具有对图形的所有时间读取访问权限,因此我决定将服务器嵌入Java应用程序中,并将同步过程放入调度程序(ScheduledExecutorService)。
问题是,尽管docs,我无法从控制台或工作室访问嵌入式服务器上运行的数据库:
orientdb> connect remote:localhost / test root myP @ss
断开与数据库的连接[null] ...确定连接到数据库 [remote:localhost / test]与用户' root' ...错误: com.orientechnologies.orient.core.exception.OStorageException:不能 打开本地存储' C:/ orientdb / databases / test'模式= rw
错误: com.orientechnologies.orient.core.exception.OSerializationException: 无法加载数据库的配置。数据库似乎已损坏
错误:com.orientechnologies.common.concur.lock.OLockException:文件 ' C:\ orientd b \ databases \ test \ database.ocf'被另一个锁定 进程,也许数据库正被另一个进程使用。使用 带有OrientDB服务器的远程模式,允许多次访问 相同的数据库
这是我的服务器初始化代码:
String orientdbHome = "C:/orientdb/";
System.setProperty("ORIENTDB_HOME", orientdbHome);
OServer server = OServerMain.create();
server.startup(new File("C:/orientdb/config/embedded_config.xml"));
OGlobalConfiguration.WAL_LOCATION.setValue("/Temp/wal");
server.activate();
OrientGraph g = new OrientGraph("plocal:C:/orientdb/databases/Test");
我是东方人的新手,所以我确信我会错过一些东西,但即便谷歌也无法帮助我搞清楚究竟是什么:(
答案 0 :(得分:0)
我认为问题在于,当您使用plocal协议进行连接时,它会锁定资源。
在您通过OrientGraph g = new OrientGraph("plocal:C:/orientdb/databases/Test");