【发布时间】:2015-10-09 08:20:43
【问题描述】:
我想在 Java 进程中执行密码查询 (link)。
这对于像MATCH xyz RETURN n 这样的所有查询都很好,但是每当我想执行和编写像CREATE 或SET 这样的操作时,就会引发异常:
Exception in thread "main" org.neo4j.graphdb.QueryExecutionException: The given query is not supported at the moment in the selected cost-based planner
at org.neo4j.kernel.impl.query.QueryExecutionKernelException.asUserException(QueryExecutionKernelException.java:35)
at org.neo4j.kernel.InternalAbstractGraphDatabase.execute(InternalAbstractGraphDatabase.java:970)
at org.neo4j.kernel.InternalAbstractGraphDatabase.execute(InternalAbstractGraphDatabase.java:957)
at MainClass.embTestQuery(MainClass.java:85)
at MainClass.main(MainClass.java:28)
代码片段:
matchingQuery = "CREATE (n:testnode) RETURN n";
try ( Transaction ignored = db.beginTx();
Result result =
db.execute( matchingQuery ))
{
while ( result.hasNext() )
{
Map<String,Object> row = result.next();
for ( Entry<String,Object> column : row.entrySet() )
{
rows += column.getKey() + ": " + column.getValue() + "; ";
}
rows += "\n";
}
}
System.out.println(rows);
引用的库:
- neo4j-consistency-check-2.2.5.jar
- neo4j-csv-2.2.5.jar
- neo4j-cypher-2.2.5.jar
- neo4j-cypher-compiler-1.9-2.0.4.jar
- neo4j-cypher-compiler-2.0-2.0.4.jar
- neo4j-cypher-compiler-2.1-2.1.8.jar
- neo4j-cypher-compiler-2.2-2.2.5.jar
- neo4j-graph-algo-2.2.5.jar
- neo4j-graph-matching-2.2.5.jar
- neo4j-import-tool-2.2.5.jar
- neo4j-io-2.2.5.jar
- neo4j-jmx-2.2.5.jar
- neo4j-kernel-2.2.5.jar
- neo4j-lucene-index-2.2.5.jar
- neo4j-primitive-collections-2.2.5.jar
- lucene-core-3.6.2.jar
- org.apache.servicemix.bundles.jline-0.9.94_1.jar
- neo4j-shell-2.2.5.jar
- neo4j-udc-2.2.5.jar
- neo4j-unsafe-2.2.5.jar
【问题讨论】:
-
你能分享你的代码吗?向我们展示您的尝试
-
您的代码使用了哪些依赖项(jar)?
-
添加了参考库和代码片段
-
GraphDatabaseSettings.read_only 已设置为 false
-
尝试更改您的密码规划器:neo4j.com/docs/stable/…