How can I refer my Neo4j embedded Db to getGraphDb() method?

I want to develop a piece of software that helps the user to open and close a Neo4j embedded server within my java application. Practically, I click the button and the web admin tool should be opened in the default web browser. However, I am stuck because I have a problem with the line code

InternalAbstractGraphDatabase graphdb = getGraphDb();

I don’t understand how to open my implemented db which is in the variable:

 private static GraphDatabaseService BORO_DB;

and has path:

public static String DB_PATH;

Below the code:

final Variable var = new Variable(true);

InternalAbstractGraphDatabase graphdb = getGraphDb();
final WrappingNeoServerBootstrapper srv;
srv = new WrappingNeoServerBootstrapper( graphdb );

final JButton btnNewButton = new JButton("Show Graph - Start Server");
btnNewButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent arg0) {

        if (var.getVar()){
            btnNewButton.setText("Graph - Stop Server");

               try {

                 String url = "http://localhost:7474";
               catch ( e) {

            btnNewButton.setText("Show Graph - Start Server");

May you teach me how to link my DB (BORO_DB) to getGraphDb()?

Thank you


Using DB_PATH, you can instantiate BORO_DB like this:

BORO_DB = new GraphDatabaseFactory().newEmbeddedDatabase(DB_PATH);

srv=new WrappingNeoServerBootstrapper((GraphDatabaseAPI) BORO_DB);

Leave a Reply

Your email address will not be published. Required fields are marked *