Java Connection neo4j JDBC

Source: Internet
Author: User
Tags stmt neo4j

NEO4J connection Java currently has embedded, JDBC, and rest APIs.

JDBC: The Lib package to use: Neo4j-jdbc-2.0.1-snapshot-jar-with-dependencies.jar

Connection con =DriverManager. getconnection ("jdbc:neo4j://localhost:7474/");//Create a connectionString Query= "Start N = node ({1}) return N.name"; PreparedStatement stmt=NULL;//with precompilation, unlike relational databases, parameters need to use {1},{2} instead of?ResultSet rs =NULL; Try{stmt=con.preparestatement (query); Stmt.setint (1, 14); RS=Stmt.executequery ();            System.out.println (Rs.getrow ());  while(Rs.next ()) {System.out.println ("A" + rs.getstring ("N.name"))); }        } Catch(Exception e) {Throwe; } finally {            if(NULL!=RS)            {Rs.close (); }            if(NULL!=stmt)            {Stmt.close (); }        }

The JDBC connection is a serviced neo4j.

At present, the Shorestpath method provided by Cypher language only supports calculating the path with the smallest number of nodes between two nodes, does not support the calculation of weights between relationships, and if the shortest path to calculate weights needs to be computed, it needs to use inline, or service-based rest API.

Java Connection neo4j JDBC

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.