neo4j-php / neo4j-php-client

Php client and driver for neo4j database
https://neo4j.com/developer/php/
MIT License
160 stars 40 forks source link

Initial Connection #16

Closed rohrig closed 3 years ago

rohrig commented 3 years ago

Firstly, I think this is a really cool package.

If I use the syntax in the Readme example I get the following error:

The provided url must have a parsed host, user and pass value

Which is easy enough to change to make php's parse_url happy.

$client = ClientBuilder::create() ->addHttpConnection('backup', 'http://neo4j:pw@localhost') ->addBoltConnection('default', 'neo4j:pw@localhost') ->setDefaultConnection('default') ->build(); pw is my password in the instance. That is inline with the readme and it throws the afore mentioned error.

If I change to the the following I get the error:
Neo4j errors detected. First one with code "Connection refused" and message ""

$client = ClientBuilder::create() // ->addHttpConnection('backup', 'http://neo4j:pw@localhost') ->addBoltConnection('default', 'http://neo4j:pw@localhost:7687') ->setDefaultConnection('default') ->build();

I'm able to connect via the neo4j browser and desktop app. I'm not sure what I"m doing wrong. Please let me know the exact syntax so a connection may be established.

rohrig commented 3 years ago

Got it.

bolt://neo4j:pw@neo4j

in case anyone else has the issue

transistive commented 3 years ago

Hello Rohrig,

Thank you for taking the time out of your day to open an issue.

Even though you correctly followed the instructions, it is indeed impossible to not provide a scheme when adding a connection. This is because it is a non-trivial problem with non-obvious defaults. eg. Is it HTTP or HTTPS, bolt+s, bolt+ssc or bolt? I have therefore decided to update the instructions and provide a stricter check when adding connections.

I have reopened the issue, just to be able to close and reference the issue with a commit which fixes the documentation.

Happy holidays,

Ghlen