cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Problem connecting using .NET Client

Hello all,
I've just installed Neo4j Desktop and I am trying to connect using .NET Client, but I receive always the error 404.
I explain the situation with some additional info:

  1. I am using a new user (admin) because I don't have the password for default neo4j user, after installation system never ask me to change it so the password is the default generated during installation but I didn't find any way to retrive it.
    I've tried also to change password but instructions found seems not updated, they request to use "neo4j stop" command but I realised that the current version of neo doesn't use it: if I stop the server still working correctly, if I send the start the system answer "No Java VM present...", so I suppose this not used anymore because my server is working correctly (I am running it on a Mac).
    Anyway to skip the user problem I've created a new user (admin, with admin rights, in order to use as a replacement for neo4j user), I am able to connect using browser to Neo4j using admin user, so it seem new user works as expected.

  2. When I try to connect using .NET Client I get the Error 404 response (resource not found), I've used the commands below:

var graphClient = new GraphClient(new Uri("http://localhost:7474/db/data"), "admin", "admin");
graphClient.Connect();

The user access (suing admin user) is correctly managed because if I put a wrong password the response is authentication error.
I need to access to default database (name is neo4j), I suspect I have to modify something in the Uri but so far I didn't found a solution.

4 REPLIES 4

Hey,

I've answered on your Stack Overflow question, but for reference I'll put the answer here as well:

You are right, the GraphClient is not able to work with a 4.x database at the moment, you can use the BoltGraphClient - but you need to provide a driver instance to it to get it to work due to a change in the way Encryption works with 4.x .

//First create a 'Driver' instance.
var driver = GraphDatabase.Driver("bolt://localhost:7687", AuthTokens.Basic("neo4j", "neo"), Config.Builder.WithEncryptionLevel(EncryptionLevel.None).ToConfig());

//Pass that driver to the BoltGraphClient
var bgc = new BoltGraphClient(driver);

//Connect.
bgc.Connect();

Hope that helps!

All the best

Chris

Im trying to use the .NET Client a community edition of Neo4J 4.1. Passing the driver as shown in the solution got my bolt connection working which was great but Ive now hit a problem trying to create a node. Using the example:

var newUser = new User { Id = 456, Name = "Jim" };
graphClient.Cypher
    .Create("(user:User {newUser})")
    .WithParam("newUser", newUser)
    .ExecuteWithoutResults();

I get this error:

Neo4j.Driver.ClientException: The old parameter syntax {param} is no longer supported. Please use $param instead (line 1, column 26 (offset: 25))
"CREATE (user:Participant {newUser})"

I tried just adding in the $newUser but it then complains that the syntax is wrong.

Is there anyway around this problem? Thanks for any advice

Ian

Hey @ian.lawton

The problem is the syntax for parameters changed, to create a node the way you are, it should look like this:

var newUser = new User { Id = 456, Name = "Jim" };
graphClient.Cypher
    .Create("(user:User $newUser)")
    .WithParam("newUser", newUser)
    .ExecuteWithoutResults();

You can see more here.

All the best

Chris

Perfect! That's fixed it. Thanks a lot Chris

Ian