Hello,

The problem I'm running into is that my embedded server isn't supporting 
any graph related sql commands (e.g. "create vertex", "out('asdf')" and 
"in('adsf')".) Those commands are completely valid on the bin/dserver.bat 
that is included in the zip file that I downloaded from Orientdb's website 
(http://orientdb.com/download/.) Part of the configuration that is used for 
the embedded server is from Orientdb's Embedded Database wiki page and the 
other parts are from dserver.bat's configuration. For the most part they 
are the same (the same plugins are used and the relevant things seem to be 
the same.) Here is my embedded server's code:

private OServer _server;
public static void main(String[] args) {
    new EmbeddedServer(args[0]);
}

public EmbeddedServer(String nodeName) {
    try {
        _server = OServerMain.create();

        _server.startup(
                "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
                        + "<orient-server>"
                        + "<handlers>"
                        + "      <handler 
class=\"com.orientechnologies.orient.graph.handler.OGraphServerHandler\">\n" +
                        "            <parameters>\n" +
                        "                <parameter value=\"true\" 
name=\"enabled\"/>\n" +
                        "                <parameter value=\"50\" 
name=\"graph.pool.max\"/>\n" +
                        "            </parameters>\n" +
                        "        </handler>\n"
                        + "      <handler 
class=\"com.orientechnologies.orient.server.handler.OServerSideScriptInterpreter\">\n"
 +
                        "            <parameters>\n" +
                        "                <parameter value=\"true\" 
name=\"enabled\"/>\n" +
                        "                <parameter value=\"SQL\" 
name=\"allowedLanguages\"/>\n" +
                        "            </parameters>\n" +
                        "        </handler>\n"
                        + "      <handler 
class=\"com.orientechnologies.orient.server.token.OrientTokenHandler\">\n" +
                        "            <parameters>\n" +
                        "                <parameter value=\"false\" 
name=\"enabled\"/>\n" +
                        "                <parameter value=\"\" 
name=\"oAuth2Key\"/>\n" +
                        "                <parameter value=\"60\" 
name=\"sessionLength\"/>\n" +
                        "                <parameter value=\"HmacSHA256\" 
name=\"encryptionAlgorithm\"/>\n" +
                        "            </parameters>\n" +
                        "        </handler>\n"
                        + "<handler 
class=\"com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin\">"
                        + "<parameters>"
                        + "<parameter 
value=\"Z:/OrientDBTest/config/default-distributed-db-config.json\" 
name=\"configuration.db.default\"/>"
                        + "<parameter 
value=\"Z:/OrientDBTest/config/hazelcast.xml\" 
name=\"configuration.hazelcast\"/>"
                        + "<parameter value=\""+nodeName+"\" 
name=\"nodeName\"/>"
                        + "</parameters>"
                        + "</handler>"
                        + "</handlers>"
                        + "<network>"
                        + "<protocols>"
                        + "<protocol name=\"binary\" 
implementation=\"com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary\"/>"
                        + "<protocol name=\"http\" 
implementation=\"com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb\"/>"
                        + "</protocols>"
                        + "<listeners>"
                        + "<listener ip-address=\"0.0.0.0\" 
port-range=\"2424-2430\" protocol=\"binary\"/>"
                        + "<listener ip-address=\"0.0.0.0\" 
port-range=\"2480-2490\" protocol=\"http\"/>"
                        + "</listeners>"
                        + "</network>"
                        + "<users>"
                        + "<user name=\"root\" password=\"asdf123$\" 
resources=\"*\"/>"
                        + "</users>"
                        + "<properties>"
                        + "    <entry value=\"1\" name=\"db.pool.min\"/>\n" +
                        "      <entry value=\"50\" name=\"db.pool.max\"/>\n" +
                        "      <entry value=\"true\" 
name=\"profiler.enabled\"/>"
                        + "    <entry name=\"log.console.level\" 
value=\"info\"/>"
                        + "    <entry name=\"log.file.level\" value=\"fine\"/>"
                        + "</properties>"
                        + "</orient-server>");
        _server.activate();
    } catch (Exception e) {
        e.printStackTrace();
    }
}


I first thought this was a configuration or dependency issue, but the 
configurations are pretty much the same and at one point I had every single 
Orientdb dependency included just in case it could have been one of them. 
Orientdb's wiki only states that the orientdb-server and 
orientdb-enterprise jars are needed for an embedded server, but I thought 
that the orientdb-graphdb jar might also be needed for graph database 
support. (The orientdb-client jar is included there, because I have a 
single project that handles the server or the client depending on the main 
class that is chosen. This is just for testing Orientdb.) My current 
build.gradle file is:

apply plugin: 'java'

sourceCompatibility = 1.7
version = '1.0'

repositories {
    mavenCentral()
}

jar {
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) 
} }
}

dependencies {
    compile 'com.orientechnologies:orientdb-graphdb:2.0.6'
    compile 'com.orientechnologies:orientdb-core:2.0.6'
    compile 'com.orientechnologies:orientdb-client:2.0.6'
    compile 'com.orientechnologies:orientdb-distributed:2.0.6'
    compile 'com.orientechnologies:orientdb-server:2.0.6'
    compile 'com.orientechnologies:orientdb-enterprise:2.0.6'
}




I've been using that code to start my server in a standalone manner. Then 
I've been using other small standalone programs for creating the database 
as well as remotely talking to the database. Here is the code I use for 
creating the database:

public class CreateDbEntry {
    public static void main(String[] args) {
        OServerAdmin server = null;
        try {
            server = new OServerAdmin("remote:"+args[0]+"/graphdb");
            server.connect("root", "asdf123$");
            if (!server.existsDatabase("plocal"))
                server.createDatabase("graph", "plocal");

            server.close(true);
            if (server.isConnected()) {
                System.out.println("We're still connected after the close()?");
            }
            else {
                System.out.println("Database Created!");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


I've been using SQL commands similar to the following:

OrientGraphFactory factory = new 
OrientGraphFactory("remote:"+database+"/graphdb", "root", 
"asdf123$").setupPool(1, 20);
OrientGraphNoTx graph = factory.getNoTx();

String readQuery = String.format("select from " +
        "(traverse OUT('reports'), OUT('followed_by'), OUT('direct_use') from 
(select from JobRecord where test_id=%d)) " +
        "where @class='Artifact'", i);

List artifacts = graph.getRawGraph().command(new 
OCommandSQL(readQuery)).execute();


and

OrientGraphFactory factory = new 
OrientGraphFactory("remote:"+database+"/graphdb", "root", 
"asdf123$").setupPool(1, 20);
OrientGraphNoTx graph = factory.getNoTx();

String deleteQuery = String.format("delete vertex from " +
        "(traverse OUT('reports'), OUT('followed_by') from (select from 
JobRecord where test_id=%d))", i);
int no = graph.getRawGraph().command(new OCommandSQL(deleteQuery)).execute();


These code snippets work perfectly well when I use them with 
bin/dserver.bat. However they do not work when I create my own embedded 
server using OServer. The bin/console.bat also has issues using queries 
such as 'create vertex' with the embedded server as well. I'm unsure of 
what the problem could be and it seems like I'm the only one that has run 
into this issue.

These are the exceptions I'm getting when I'm executing sql graph queries 
against the embedded server (these exceptions were printed by the server):

2015-04-10 14:31:38:780 INFO  [node1] received new status node1.graphdb=ONLINE 
[OHazelcastPlugin]Sent run-time exception to the client /127.0.0.1:51399: 
com.or
ientechnologies.orient.core.exception.OQueryParsingException: Error on 
parsing query at position #111: Error on parsing query
Query:  (traverse OUT('reports'), OUT('followed_by'), OUT('direct_use') from 
(select from JobRecord where test_id=0)) where @class='Artifact'
--------------------------------------------------------------------------------------------------------------------^
com.orientechnologies.orient.core.exception.OQueryParsingException: Error 
on parsing query at position #111: Error on parsing query
Query:  (traverse OUT('reports'), OUT('followed_by'), OUT('direct_use') from 
(select from JobRecord where test_id=0)) where @class='Artifact'
--------------------------------------------------------------------------------------------------------------------^
        at com.orientechnologies.orient.core.sql.filter.OSQLTarget.<init>(
OSQLTarget.java:76)
        at com.orientechnologies.orient.core.sql.OSQLEngine.parseTarget(
OSQLEngine.java:440)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.
parse(OCommandExecutorSQLSelect.java:218)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.
parse(OCommandExecutorSQLSelect.java:96)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate
.parse(OCommandExecutorSQLDelegate.java:56)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate
.parse(OCommandExecutorSQLDelegate.java:37)
        at com.orientechnologies.orient.server.distributed.
ODistributedStorage.command(ODistributedStorage.java:223)
        at com.orientechnologies.orient.core.command.
OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:63)
        at com.orientechnologies.orient.server.network.protocol.binary.
ONetworkProtocolBinary.command(ONetworkProtocolBinary.java:1178)
        at com.orientechnologies.orient.server.network.protocol.binary.
ONetworkProtocolBinary.executeRequest(ONetworkProtocolBinary.java:385)
        at com.orientechnologies.orient.server.network.protocol.binary.
OBinaryNetworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:
220)
        at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.
java:69)
Caused by: com.orientechnologies.orient.core.sql.OCommandSQLParsingException
: Error on parsing command at position #0: No function with name 'out', 
available n
ames are : [date,encode,distance,document,distinct,traversedelement,sum,
decode,uuid,mode,sysdate,avg,min,traversededge,ifnull,traversedvertex,stddev
,if,map,uni
onall,set,intersect,last,max,coalesce,count,format,list,eval,percentile,
median,variance,difference,first]
        at com.orientechnologies.orient.core.sql.OSQLEngine.getFunction(
OSQLEngine.java:399)
        at com.orientechnologies.orient.core.sql.functions.
OSQLFunctionRuntime.setRoot(OSQLFunctionRuntime.java:202)
        at com.orientechnologies.orient.core.sql.filter.
OSQLFilterItemAbstract.<init>(OSQLFilterItemAbstract.java:61)
        at com.orientechnologies.orient.core.sql.functions.
OSQLFunctionRuntime.<init>(OSQLFunctionRuntime.java:55)
        at com.orientechnologies.orient.core.sql.OSQLHelper.getFunction(
OSQLHelper.java:220)
        at com.orientechnologies.orient.core.sql.OSQLHelper.parseValue(
OSQLHelper.java:198)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLTraverse
.parseFields(OCommandExecutorSQLTraverse.java:209)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLTraverse
.parse(OCommandExecutorSQLTraverse.java:70)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLTraverse
.parse(OCommandExecutorSQLTraverse.java:55)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate
.parse(OCommandExecutorSQLDelegate.java:56)
        at com.orientechnologies.orient.core.sql.filter.OSQLTarget.
extractTargets(OSQLTarget.java:177)
        at com.orientechnologies.orient.core.sql.filter.OSQLTarget.<init>(
OSQLTarget.java:67)
        ... 11 more


Sent run-time exception to the client /127.0.0.1:51704: com.
orientechnologies.orient.core.command.OCommandExecutorNotFoundException: 
Cannot find a command exec
utor for the command request: sql.create vertex
com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: 
Cannot find a command executor for the command request: sql.create vertex
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate
.parse(OCommandExecutorSQLDelegate.java:52)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate
.parse(OCommandExecutorSQLDelegate.java:37)
        at com.orientechnologies.orient.server.distributed.
ODistributedStorage.command(ODistributedStorage.java:223)
        at com.orientechnologies.orient.core.command.
OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:63)
        at com.orientechnologies.orient.server.network.protocol.binary.
ONetworkProtocolBinary.command(ONetworkProtocolBinary.java:1178)
        at com.orientechnologies.orient.server.network.protocol.binary.
ONetworkProtocolBinary.executeRequest(ONetworkProtocolBinary.java:385)
        at com.orientechnologies.orient.server.network.protocol.binary.
OBinaryNetworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:
220)
        at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.
java:69)

Thanks for reading.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to