tomcat - neo4j : Limited queries sent in java -
for website developed under tomcat, connect program database neo4j. connection done through jdbc. program right local, , database on remote server. when start tomcat, first check if specifics nodes presents, , if not, creates them. there 135 nodes. problem : after ten, program stops, , stay in infinite loop. assume should close something, what? here code :
private resultset sendcommand(string command) throws sqlexception { try(statement statement = _neo4jconnection.createstatement()) { return statement.executequery(command); } }
and function call code (all functions based on same structure)
public static long createnode(nodelabel labelname) { try { resultset rs = getinstance().sendcommand("create (n:"+labelname+") return id(n)"); long result= rs.next()?rs.getlong("id(n)"):null; rs.close(); return result; } catch (sqlexception e) { e.printstacktrace(); return null; } }
in latest experiment reused same statement multiple times, not sure best way seems work good, too.
https://github.com/peterneubauer/blogs/tree/master/csv_jdbc, code @ https://github.com/peterneubauer/blogs/blob/master/csv_jdbc/src/test/java/org/neo4j/jdbctest/jdbctest.java
Comments
Post a Comment