Different between neo4j:// and bolt://

Hello everyone, I am beginner of neo4j.

I'm using neo4j:latest docker environment, when I visit neo4j browser I find that neo4j is set default to connect with neo4j protocol like 'neo4j://xxx.xxx.xxx.xxx:7687'.
When I use a javascript driver to interact with neo4j through neo4j protocol, I find that the change made by js driver is not visiable to neo4j browser.
Then I change protocol used by the browser and js driver to bolt protocol like 'bolt://xxx.xxx.xxx.xxx:7687', everything works find.
I notice that when I use neo4j protocol and bolt protocol to connect, it seems that I'm using two different database.
Then I do some experiment:

  • Browser use "neo4j://" and driver use "neo4j://": not working.
  • Browser use "neo4j://" and driver use "bolt://": not working.
  • Browser use "bolt://" and driver use "neo4j://": works.
  • Browser use "bolt://" and driver use "bolt://": works.

Anyone can explain what is happening?

Thanks a lot!

Here's more info on the two protocols:

Though here's the things that are important to know:

neo4j:// will work on either a single instance or a cluster. If used on a cluster, it's the equivalent of the bolt+routing:// protocol from Neo4j 3.5.x and earlier, it will route to a cluster member, not necessarily the system at the IP that you specified. Queries executed over that protocol will route according to the transaction functions you're using in your driver...if using a write transaction, they will go to the leader. If using a read transaction, they will route between followers and/or read replicas.

bolt:// will connect only to the server with the IP you specify. It will not route anywhere else. All queries over this protocol will go only to this machine, whether they're read or write queries (and of course write queries will error out if not being sent to the cluster leader).

If used on a single server (not a cluster), then queries over them will behave identically. You should only see different behavior between them if you're addressing a server that's part of a cluster.

2 Likes

Thank you very much for your reply :grinning: