Take a look to database types.
Document Database offers a good compromise between speed and flexibility.
We show how to
- Connect to a database and open it
- Create a document (record) and populate fields
- Persist the document (record) created
- Close database
public class OrientDBTest {
public static void main(String[] args) {
//Connect to database
ODatabaseDocumentTx db = new ODatabaseDocumentTx("local:/tmp/db/scratchpad");
//Open database with user and password
db.open("admin", "admin");
//Create a new document (record)
ODocument doc = db.newInstance();
//Populate the fields
doc.field("name", "Jay");
doc.field("surname", "Miner");
//Persist data
doc.save();
//Close database
db.close();
}
}
No comments:
Post a Comment