问题
I had a task to create a simple application using eclipse as a tool and OrientDB through java, u can look into the code that I have posted below and I have connected to the OrientDB server, I'm getting the output on the console window but I want to command from the web page that is on client side. Please help me out in firing queries on the client side.
package test;
import com.orientechnologies.orient.core.sql.OCommandSQL;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.orient.OrientEdge;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
public class Sample {
public static void main(String[] args) {
// TODO Auto-generated method stub
Sample sam = new Sample();
sam.run();
}
@SuppressWarnings("unchecked")
public void run() {
OrientGraph graph = new OrientGraph("plocal:C:\\Users\\Labuser\\Desktop\\orientdb-community-2.2.12\\databases\\OBD", "admin", "admin");
graph.createVertexType("Person");
graph.createVertexType("Address");
Vertex vPerson = graph.addVertex("class:Person");
vPerson.setProperty("firstName", "John");
vPerson.setProperty("lastName", "Smith");
Vertex vAddress = graph.addVertex("class:Address");
vAddress.setProperty("street", "Van Ness Ave.");
vAddress.setProperty("city", "San Francisco");
vAddress.setProperty("state", "California");
Vertex vPerson1 = graph.addVertex(null);
OrientEdge eLives = graph.addEdge("class:lives", vPerson, vAddress, null);
for (Vertex v : (Iterable<Vertex>) graph.command(
new OCommandSQL(
"SELECT * FROM V"
)).execute()) {
System.out.println("- Bought: " + v);
}
}
}
来源:https://stackoverflow.com/questions/41179681/orientdb-client-side-firing-query