1

I'm embarking on a self exploratory project regarding Neo4j database on the Panama Papers by ICIJ.

Aim: I would like to run python packages that does network analysis such as graph-tool, networkx on the database that is found on Neo4j.

Hence these are the steps that I took:

  1. Load Neo4j-driver, which I did load
  2. Connect to the Neo-4j sandbox through pycharm

This is the code:

#

from neo4j.v1 import GraphDatabase, basic_auth

driver = GraphDatabase.driver(
    "bolt://34.239.248.240:33621",
    auth=basic_auth("neo4j", "fares-documentation-reproductions"))
session = driver.session()

# What are the Entities in Panama Papers?
cypher_query = '''
MATCH (e:Entity)
RETURN e.name AS name LIMIT $limit
'''

results = session.run(cypher_query,
  parameters={"limit": 10})

for record in results:
  print(record['name'])

#

This was the error message shown:

neo4j.exceptions.ServiceUnavailable: Cannot acquire connection to Address(host='34.239.248.240', port=33621)

I've obtained the bolt/port/host from the sandbox website: https://neo4j.com/sandbox-v2/

Also, I tried to check if the neo4j-driver has been installed correctly, and I ran the testdriver code:

#

from neo4j.v1 import GraphDatabase

uri = "bolt://localhost:7474"
driver = GraphDatabase.driver(uri, auth=("neo4j", "user"))

def print_friends_of(name):
    with driver.session() as session:
        with session.begin_transaction() as tx:
            for record in tx.run("MATCH (a:Person)-[:KNOWS]->(f) "
                                 "WHERE a.name = {name} "
                                 "RETURN f.name", name=name):
                print(record["f.name"])

print_friends_of("Alice")

#

In which this error code was shown:

neo4j.exceptions.SecurityError: Failed to establish secure connection to '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:749)'

Could you advise?

Sherly
  • 75
  • 6
  • I believe the bolt protocol is usually hosted on 7687. Can you try with that port? Or try http instead of bolt with 7474 – lordingtar Jul 21 '17 at 07:03
  • @lordingtar i tried to host it in 7687 but it doesn't work as well. I'm avoiding the use of http as I would like to connect the local server. – Sherly Jul 24 '17 at 01:38
  • 1
    the bolt port is 7687 but not 7474. 7474 is the http port but not https. If you want https you can enable it from you neo4j.conf file then use https://localhost:port. Hope this helps – techie95 Oct 26 '17 at 12:19

1 Answers1

0

I managed to solve this problem by downloading the graph db database directly into my local server. The bolt port is 7474.

Sherly
  • 75
  • 6