My first OrientDB - Help

36 views
Skip to first unread message

jeffg

unread,
Feb 11, 2011, 4:44:09 PM2/11/11
to OrientDB
Trying to get my feet wet with OrientDB and BluePrints and I'm getting
an error. I copied the account files from the demo databases into my
path. Also, how do I create a database? Seems to want to open an
existing db.

import com.tinkerpop.blueprints.pgm.*;
import com.tinkerpop.blueprints.pgm.impls.orientdb.OrientGraph;
import com.orientechnologies.*;

Graph graph = new TinkerGraph();
Graph db = new OrientGraph(dataPath("account.och"));
Vertex a = graph.addVertex(null);
Vertex b = graph.addVertex(null);
a.setProperty("name", "marko");
a.setProperty("name", "peter");
Edge e = graph.addEdge(null, a, b, "knows");
graph.shutdown();


processing.app.debug.RunnerException: ODatabaseException: Error on
opening database '/Users/Jeff/Documents/Processing/TestSketches/
Blueprint/data/account.och'
at processing.app.Sketch.placeException(Sketch.java:1543)
at processing.app.debug.Runner.findException(Runner.java:583)
at processing.app.debug.Runner.reportException(Runner.java:558)
at processing.app.debug.Runner.exception(Runner.java:498)
at processing.app.debug.EventThread.exceptionEvent(EventThread.java:
367)
at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
at processing.app.debug.EventThread.run(EventThread.java:89)
Exception in thread "Animation Thread"
com.orientechnologies.orient.core.exception.ODatabaseException: Error
on opening database '/Users/Jeff/Documents/Processing/TestSketches/
Blueprint/data/account.och'
at
com.orientechnologies.orient.core.db.raw.ODatabaseRaw.<init>(ODatabaseRaw.java:
79)
at
com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.<init>(ODatabaseRecordAbstract.java:
76)
at
com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.<init>(ODatabaseRecordTx.java:
35)
at
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:
33)
at
com.orientechnologies.orient.core.db.graph.ODatabaseGraphTx.<init>(ODatabaseGraphTx.java:
42)
at
com.tinkerpop.blueprints.pgm.impls.orientdb.OrientGraph.openOrCreate(OrientGraph.java:
356)
at
com.tinkerpop.blueprints.pgm.impls.orientdb.OrientGraph.<init>(OrientGraph.java:
57)
at
com.tinkerpop.blueprints.pgm.impls.orientdb.OrientGraph.<init>(OrientGraph.java:
50)
at Blueprint.setup(Blueprint.java:175)
at processing.core.PApplet.handleDraw(PApplet.java:1583)
at processing.core.PApplet.run(PApplet.java:1503)
at java.lang.Thread.run(Thread.java:680)
Caused by:
com.orientechnologies.orient.core.exception.OConfigurationException:
Error in database URL: the engine was not specified. Syntax is:
<engine>:<db-type>:<db-name>[?<db-param>=<db-value>[&]]*. URL was: /
Users/Jeff/Documents/Processing/TestSketches/Blueprint/data/
account.och
at com.orientechnologies.orient.core.Orient.getStorage(Orient.java:
75)
at
com.orientechnologies.orient.core.db.raw.ODatabaseRaw.<init>(ODatabaseRaw.java:
69)
... 11 more

Marko Rodriguez

unread,
Feb 11, 2011, 4:49:44 PM2/11/11
to orient-...@googlegroups.com
Hi,

It looks like you are mixing TinkerGraph and OrientDB. You want to just use OrientDB.

Thus,

Graph graph = new OrientGraph("local:/tmp/adirectory/graph");


Vertex a = graph.addVertex(null);
Vertex b = graph.addVertex(null);
a.setProperty("name", "marko");
a.setProperty("name", "peter");
Edge e = graph.addEdge(null, a, b, "knows");
graph.shutdown();

Also, you need the "local:" prefix and you don't need TinkerGraph.

Hope that helps,
Marko.

http://markorodriguez.com

jeffg

unread,
Feb 11, 2011, 4:51:39 PM2/11/11
to OrientDB
Thanks.. figured it just as you posed... I didn't have "local:" in
front of it.
Reply all
Reply to author
Forward
0 new messages