Sriniketh
Sriniketh

Reputation: 55

How to view my database from the neo4j browser?

I am new to neo4j. I have created a java project in Eclipse to create a neo4j database and some nodes in it. I am seeing the database directory getting created in my workspace folder. But how do i view it on the neo4j browser?

Here is the example code i used :

package com.neo4j.demo;

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;

public class Neo4jDemoOperations {
public static void main(String args[]) {
        GraphDatabaseFactory dbFactory = new GraphDatabaseFactory();
        GraphDatabaseService db =     dbFactory.newEmbeddedDatabase("./DemoDatabase");
        try (Transaction tx = db.beginTx()) {

        Node javaNode = db.createNode(Tutorials.JAVA);
        javaNode.setProperty("TutorialID", "JAVA001");
        javaNode.setProperty("Title", "Learn Java");
        javaNode.setProperty("NoOfChapters", "25");
        javaNode.setProperty("Status", "Completed");

        Node scalaNode = db.createNode(Tutorials.SCALA);
        scalaNode.setProperty("TutorialID", "SCALA001");
        scalaNode.setProperty("Title", "Learn Scala");
        scalaNode.setProperty("NoOfChapters", "20");
        scalaNode.setProperty("Status", "Completed");

        Relationship relationship = javaNode.createRelationshipTo(
                scalaNode, TutorialRelationships.JVM_LANGIAGES);
            relationship.setProperty("Id", "1234");
            relationship.setProperty("OOPS", "YES");
            relationship.setProperty("FP", "YES");

            tx.success();
        }
        System.out.println("Done successfully");

    }
}

The Tutorials and TutorialRelationships are enums.

Thanks in advance.

Upvotes: 0

Views: 940

Answers (1)

Sriniketh
Sriniketh

Reputation: 55

I changed the path to the database in the line

org.neo4j.server.database.location=

in the file neo4j-server.properties inside the conf folder. I chose the path as the path to my database in the workspace folder and it worked!

Upvotes: 1

Related Questions