java - How can I get the path of my Neo4j <config storeDirectory=""> in a Batch Inserter method? -


i'm using neo4j 2.2.8 , spring data in web application. i'm using xml configure database, like:

<neo4j:config storedirectory="s:\neo4j\mybase" /> 

but i'm trying use batch inserter add more 1 million of nodes sourced .txt file. after reading file , setting list of objects, code batch like:

public void batchinserter(list<objects> objects) {      batchinserter inserter = null;     try {         inserter = batchinserters.inserter("s:\\neo4j\\mybase");                      label movimentoslabel = dynamiclabel.label("movimentos");         inserter.createdeferredschemaindex(movimentoslabel).on("documento").create();          (objects objs : objects{                             map<string, object> properties = new hashmap<>();             properties.put("documento", objs.getdocumento());             long movimento = inserter.createnode(properties, movimentoslabel);                              dynamicrelationshiptype relacionamento = dynamicrelationshiptype.withname("conta_movimento");             inserter.createrelationship(movimento, objs.getconta().getid(), relacionamento, null);         }     } {         if (inserter != null) {             inserter.shutdown();         }     } } 

is possible path of database configured in xml in "inserter"? because above configuration neo4j gives me error multiple connections. can set property solve error of multiple connections? has had problem , have idea how solve it? ideas welcome.

thanks everyone!

your question has several pieces it:

error multiple connections

if you're using spring-data local database tied particular directory or file, aware can't have 2 neo4j processes opening same db @ same time. means if you've decided use batchinserter against same file/directory, cannot happen @ while jvm that's using spring-data db running. there won't way know of around problem. 1 option not use batch inserter against file, use rest api inserting.

get path of database configured in xml

sure, there's way that, you'd have consult relevant documentation. can't give code because depends on config file your'e talking , how it's structured, in essence there should way inject right thing code here, , read property xml file out of injected object.

but won't given "multiple connections" issue mentioned above.

broadly, think solution either:

  1. don't run spring app , batch inserter @ same time.
  2. run spring app, insertion via rest api or other method, there isn't multiple connection issue begin with.

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -