问题
I am trying to setup a remote OrientDB Server and I am trying to enter vertices into it from local Java code.
When I try the following code:
private static final void dropDb() {
OrientGraphNoTx graph = new OrientGraphNoTx(ORIENT_URL);
graph.drop();
}
I get an Exception saying:
Exception in thread "main" com.orientechnologies.orient.core.exception.ODatabaseException: Cannot delete database
...
Caused by: java.lang.UnsupportedOperationException: Cannot delete a database in a remote server. Please use the console or the OServerAdmin class.
How do I go about deleting a remote graph, using Java, in OrientDB?
回答1:
He jackofblades,
the Graph answers your question:
Please use the console or the OServerAdmin class
// CREATE A SERVER ADMIN CLIENT AGAINST A REMOTE SERVER
OServerAdmin serverAdmin = new OServerAdmin("remote:localhost/GratefulDeadConcerts").connect("admin", "admin");
serverAdmin.dropDatabase("GratefulDeadConcerts");
This is taken from the OrientDB Wiki Page
Patrick
来源:https://stackoverflow.com/questions/26485074/how-to-drop-a-remote-graph-using-java-in-orientdb