Skip to content

Instantly share code, notes, and snippets.

@sarmbruster
Last active December 20, 2015 07:38
Show Gist options
  • Save sarmbruster/6094267 to your computer and use it in GitHub Desktop.
Save sarmbruster/6094267 to your computer and use it in GitHub Desktop.
how to use Neo4j's Cypher over JDBC from a groovy script
@GrabResolver(name="neo4j", root="http://m2.neo4j.org/")
@GrabResolver(name="restlet", root="http://maven.restlet.org/")
@GrabConfig(systemClassLoader = true)
@Grab('org.neo4j:neo4j-jdbc:1.9')
import groovy.sql.*
def sql = Sql.newInstance('jdbc:neo4j://localhost:7474/')
println "simple cypher statement"
sql.eachRow("start n=node(*) return n") {
println "row $it"
}
println "parameterized cypher statement"
sql.eachRow("start n=node({1}) return n", [0]) {
println "row $it"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment