Hi,
rs = conn.createStatement().executeQuery("match n return n");
is going to return n as a String representation of the node-- you won't get
a Node object itself.
To get the name property value, you can use:
try {
rs = conn.createStatement().executeQuery("match n return n.name");
while (rs.next())
{
String name = rs.getString(1);
System.out.println("name: " + name);
}
}
Regards
Luanne
On Sat, Feb 8, 2014 at 9:49 PM, frandro <[email protected]> wrote:
> I just made a node in Cypher like as CREATE (S:User {name:"S"})
>
> I'd like to get the name by querying with JDBC.
>
> The printed result is name: {"name":"S"}. Why isn't it name: S?
>
> What's wrong? Thanks in advance.
>
> The code is as follows.
>
> driver=new Driver();
> prop=new Properties();
>
> try {
> conn = driver.connect("jdbc:neo4j://localhost:7474", prop);
> } catch (SQLException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> String query = "match n return n";
> ResultSet rs = null;
>
> try {
> rs = conn.createStatement().executeQuery("match n return n");
>
> while (rs.next())
> {
> String name = rs.getString(1);
> System.out.println("name: " + name);
>
> }
> }
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" 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/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"Neo4j" 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/groups/opt_out.