我是OrientDB的新手,所以我只想插入一个文件来修补它。 我检查了一些文档并写了这个:
public static void main(String[] args) {
ODatabaseDocumentTx db = ODatabaseDocumentPool.global().acquire("remote:localhost/petshop", "admin", "admin");
try {
db.begin(OTransaction.TXTYPE.OPTIMISTIC);
ODocument animal = new ODocument("Animal");
animal.field( "name", "Gaudi" );
animal.field( "location", "Madrid" );
animal.save();
db.commit();
} finally {
db.close();
}
}
现在文档被插入,我可以从控制台检查,但是这个程序只是挂起在db.commit();
这是它挂起的主题:
"main@1" prio=5 tid=0x1 nid=NA runnable
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(SocketInputStream.java:-1)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
- locked <0x4ff> (a java.io.BufferedInputStream)
at java.io.DataInputStream.readInt(DataInputStream.java:387)
at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.readInt(OChannelBinary.java:99)
at com.orientechnologies.orient.client.remote.OStorageRemote.readCollectionChanges(OStorageRemote.java:1895)
at com.orientechnologies.orient.client.remote.OStorageRemote.commit(OStorageRemote.java:1099)
at com.orientechnologies.orient.client.remote.OStorageRemoteThread.commit(OStorageRemoteThread.java:456)
at com.orientechnologies.orient.core.tx.OTransactionOptimistic.doCommit(OTransactionOptimistic.java:119)
at com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:105)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.commit(ODatabaseRecordTx.java:142)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:504)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:496)
at OrientTest.main(OrientTest.java:23)
服务器脱口而出以下警告:
2014-05-29 12:03:17:922 WARN Current implementation of storage does not support sbtree collections [ODatabaseRecordAbstract$1]
我错过了什么吗?我使用的是orientdb 1.7。
答案 0 :(得分:5)
我创建了这样的数据库:
create database remote:localhost/petshopp root passwd local
虽然我应该使用:
create database remote:localhost/petshopp root passwd plocal