0

Is it possible to connect to a Neo4j or Memgraph database over IPv6? I am using the neo4j-driver javascript library but it seems that it is not able to parse a IPv6 connection string:

const driver = neo4j.driver("bolt://fdaa:0:a23f:a7b:c988:dd94:aff3:2:7687"); // Error: getaddrinfo ENOTFOUND fdaa
W4G1
  • 1,337
  • 1
  • 11
  • 15

3 Answers3

1

I tried it with Javascript but doesn't work for me neither. Probably neo4j's driver for Javascript doesn't support ipv6.

I found here https://community.neo4j.com/t5/neo4j-graph-platform/troubleshooting-connection-issues-to-neo4j/m-p/47959 that the possible solution could be setting the flag

dbms.connectors.default_listen_address=::1

but that possibly means only configuring the loopback address will be parsed from IPv6.

Memgraph reuses the Neo4J's Javascript driver so that won't work as well, but the GQLAlchemy which is able to connect to Memgraph does parse IPv6 without any problems, with the following code snippet:

from gqlalchemy import Memgraph

if __name__ == "__main__":
    memgraph = Memgraph(host='0:0:0:0:0:0:0:1', port=7687)

    memgraph.drop_database()
    
    memgraph.execute("CREATE (n);")
    result = next(memgraph.execute_and_fetch("MATCH (n) RETURN COUNT(n) as cnt;"))
    print(result['cnt'])

The only downside is, it is built in Python, which was not your preferred choice of language.

1

Try wrapping the IPv6 address in brackets like so

const driver = neo4j.driver("bolt://[fdaa:0:a23f:a7b:c988:dd94:aff3:2]:7687");

I'm not sure this will work with the JS driver, but this is how you would do it with the Neo4j Python driver.

Robsdedude
  • 1,292
  • 16
  • 25
0

Actually, it will work with Memgraph too: add the brackets like mentioned and make sure that you start Memgraph with --bolt-address parameter set to ::1. You can check here how to do this.