Database Reference
In-Depth Information
GraphDatabaseFactory graphFactory = new
GraphDatabaseFactory();
GraphDatabaseBuilder graphBuilder =
graphFactory.newEmbeddedDatabaseBuilder("Location of
Storing Neo4j Database Files");
graphBuilder.loadPropertiesFromFile("location of file
containing the Neo4j database properties");
GraphDatabaseService graphDb =
graphBuilder.newGraphDatabase();
Note
We can also configure the Neo4j database properties using the GraphData-
baseBuilder.setConfig(…) method. For example, graphBuild-
er.setConfig(GraphDatabaseSettings.dump_configuration,"true"); .
For the available configuration parameters, refer to the attributes defined in
org.neo4j.graphdb.factory.GraphDatabaseSettings.java at ht-
tp://neo4j.com/docs/2.1.5/javadocs/org/neo4j/graphdb/factory/GraphDatabaseSet-
tings.html .
Before moving to the next section, let's also discuss the process of manually configuring
the Java project. Perform the following steps to manually configure your Java project:
1. Download and open your favorite IDE (Eclipse, IntelliJ, NetBeans, and so on),
create a new Java project, and name it as MyNeo4jSamples .
2. Add all the JAR files from $NEO4J_HOME>/lib as the dependency to your
new Java project.
3. Add a new package in your Java project by the name
neo4j.embedded.myserver .
4. Next, create a Java class
neo4j.embedded.myserver.EmbeddedServer.java and add the
same code that we discussed in step 3 for Maven-based projects.
5. Next, directly execute code from your IDE and the results will be the same as you
see with your Maven-based Java projects.
Note
Using appropriate plugins, you can create and execute Maven projects from the IDE itself.
For example, in Eclipse, you can install and use M2E plugins. For more information, refer
to http://eclipse.org/m2e/ .
Search WWH ::




Custom Search