我认为 agens-graph 是一个很好的图形数据库,我做了一些演示。但它不起作用。来人帮帮我?
Class.forName("net.bitnine.agensgraph.Driver");
String connectionString = "jdbc:agensgraph://127.0.0.1:5433/agens";
Properties properties = new Properties();
properties.setProperty("username","agens");
properties.setProperty("password","123456");
properties.setProperty("graph_path","graphname");
properties.setProperty("user","agens");
Connection conn = DriverManager.getConnection(connectionString,properties);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(
"MATCH (n:person {name: 'Tom'})-[:knows]->(m:person) RETURN n.name AS n, m.name AS m;");
while (rs.next()) {
Vertex friend = (Vertex) rs.getObject(1);
System.out.println(friend.getString("n"));
System.out.println(friend.getInt("m"));
}
安慰:
Exception in thread "main" org.postgresql.util.PSQLException: ERROR: graph_path is NULL
建议:使用 SET graph_path at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2477) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2190) at org.postgresql.core。 v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300) 在 org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428) 在 org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354) 在 org.postgresql .jdbc.PgStatement.executeWithFlags(PgStatement.java:301) 在 org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:287) 在 org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:264) 在 org. postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:231) 在 agensgraph 的 net.bitnine.agensgraph.jdbc.AgStatement.executeQuery(AgStatement.java:43)。AgensgraphTest.main(AgensgraphTest.java:18)