基于Java的文档数据库 OrientDB
openkk
13年前
<div id="p_fullcontent" class="detail"> <p>Orient DB 是一个可伸缩的文档数据库,支持 ACID 事务处理。使用 Java 5 实现。</p> <p><img alt="基于Java的文档数据库 OrientDB" src="https://simg.open-open.com/show/78175565f23b3d807150d6cb4bb82902.jpg" width="640" height="399" /></p> <p>使用示例:</p> <pre class="brush:java; toolbar: true; auto-links: false;">// OPEN THE DATABASEODatabaseDocumentTx db = new ODatabaseDocumentTx("remote:localhost/petshop").open("admin", "admin"); // CREATE A NEW DOCUMENT AND FILL ITODocument doc = new ODocument("Person"); doc.field( "name", "Luke" ); doc.field( "surname", "Skywalker" ); doc.field( "city", new ODocument("City" ).field("name","Rome").field("country", "Italy") ); // SAVE THE DOCUMENT doc.save(); // QUERY THE DOCUMENT List <odocument> result = database.query( new OSQLSynchQuery>("select * from person where city.name = 'Rome'")).execute(); // PRINT THE RESULT SET for( ODocument d : result ){ System.out.println("Person: " + d.field( "name" ) + d.field( "surname" )); } db.close(); </odocument></pre> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1322707915546" target="_blank">http://www.open-open.com/lib/view/home/1322707915546</a></p> <p></p> </div>