How to access the database from other systems

Hi,

I am new to Neo4j. I want to use Neo4j database. And I have to give access to connect to that Neo4j database(That I have created in my system) from other systems via python program. Could you please let me know how to achieve this functionality which neo4j edition I have to download and how can I access the database i created in my system from other system.

Do the other systems should also have to download Neo4j, if yes which edition.

Also, is it possible to achieve this in Linux. Which will be the best(Windows or Linux) can you suggest.

Thank you

Typically one would access Neo4j from other systems by utilizing one of the Neo4j database drivers ( https://neo4j.com/docs/ and search for Drivers and APIs and to which we offer drivers for the following languages ( .Net, Python, Java, Javascript).

There is also a standlone kit for cypher-shell at https://neo4j.com/download-center/ (search for cypher-shell) and allows a command line utility to query the database. However as it is command line, it does not have any significant visual representation.

Finally, if you install Neo4j you could always allow for remote connection to the Neo4j Browser at http://:7474

Hi,

I have downloaded Neo4j Community Edition. I opened command prompt and connected to Neo4j console by following command.
<NEO4J_HOME>\bin\neo4j console
I got this in command prompt
2019-11-21 06:37:11.980+0000 INFO ======== Neo4j 3.5.12 ========
2019-11-21 06:37:11.984+0000 INFO Starting...
2019-11-21 06:37:20.951+0000 INFO Bolt enabled on 127.0.0.1:7687.
2019-11-21 06:37:22.462+0000 INFO Started.
2019-11-21 06:37:23.730+0000 INFO Remote interface available at http://localhost:7474/

I opened google chrome browser and opened http://localhost:7474/ I changed the pwd and connected to bolt://127.0.0.1:7687
I created some nodes and relationships in the database.
I wrote below python program(KB.py)
image

When I ran KB.py in my system, it gave me results.

Now i want to connect to this database from other system.
I followed your comments in this forum and changed the neo4j.conf file by updating define parameter dbms.connectors.default_advertised_address=0.0.0.0 . After making this change I restarted Neo4j in command prompt again by command <NEO4J_HOME>\bin\neo4j console
This time it gave me this in command prompt
D:\neo4j\bin>neo4j console
2019-11-21 06:52:02.666+0000 INFO ======== Neo4j 3.5.12 ========
2019-11-21 06:52:02.682+0000 INFO Starting...
2019-11-21 06:52:11.286+0000 INFO Bolt enabled on 127.0.0.1:7687.
2019-11-21 06:52:12.723+0000 INFO Started.
2019-11-21 06:52:13.551+0000 INFO Remote interface available at http://0.0.0.0:7474/

Now i am running KB.py from another machine without changing any code in KB.py. But it is not giving any results from another machine. It gives below error
Traceback (most recent call last):
File "C:\Python\Python37\lib\site-packages\neobolt\direct.py", line 835, in connect
s.connect(resolved_address)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:/Python_games/kb1/KB.py", line 22, in
kb = KB()
File "E:/Python_games/kb1/KB.py", line 13, in init
self.driver = GraphDatabase.driver(uri=uri, auth=(author,password))
File "C:\Python\Python37\lib\site-packages\neo4j_ init
.py", line 120, in driver
return Driver(uri, **config)
File "C:\Python\Python37\lib\site-packages\neo4j_ init .py", line 161, in new
return subclass(uri, **config)
File "C:\Python\Python37\lib\site-packages\neo4j
init .py", line 235, in new
pool.release(pool.acquire())
File "C:\Python\Python37\lib\site-packages\neobolt\direct.py", line 719, in acquire
return self.acquire_direct(self.address)
File "C:\Python\Python37\lib\site-packages\neobolt\direct.py", line 612, in acquire_direct
connection = self.connector(address, error_handler=self.connection_error_handler)
File "C:\Python\Python37\lib\site-packages\neo4j
init _.py", line 232, in connector
return connect(address, **dict(config, **kwargs))
File "C:\Python\Python37\lib\site-packages\neobolt\direct.py", line 976, in connect
raise last_error
File "C:\Python\Python37\lib\site-packages\neobolt\direct.py", line 966, in connect
s = _connect(resolved_address, **config)
File "C:\Python\Python37\lib\site-packages\neobolt\direct.py", line 847, in _connect
raise ServiceUnavailable("Failed to establish connection to {!r} (reason {})".format(resolved_address, error))
neobolt.exceptions.ServiceUnavailable: Failed to establish connection to ('127.0.0.1', 7687) (reason [WinError 10061] No connection could be made because the target machine actively refused it)
Process finished with exit code 1

When I run from KB.py my machine it is giving results. Could you please help me how can I connect to the neo4j database in my machine from another machine.

Thank you

your KB.py includes
uri = "bolt://127.0.0.1:7687"
to which this would indicate attempt to connect to a Neo4j database running as 127.0.0.1, of which this is typically synonymous with localhost (i.e. the same machine where the command is run).
If you want KB.py to connect to a Neo4j instance running at some other IP then you would need to change this to the IP of the remote machine that Neo4j is running at.

2 Likes

Thank you. It resolved the issue.