DotNet4Neo4j / Neo4jClient

.NET client binding for Neo4j
https://www.nuget.org/packages/Neo4jClient
Microsoft Public License
431 stars 146 forks source link

DATABASE commands are not supported in Neo4j versions older than 4.0 #401

Closed arturotrenard closed 3 years ago

arturotrenard commented 3 years ago

Hi, I am using the neo4j version:

Version: 4.2.3 Edition: Community Name: neo4j Databases: :dbs Information: :sysinfo Query List: :queries

And to connect I use the client version: Neo4jClient 4.1.5.

And I am trying to create a DB in the following way:

public class WriteInNeo4J
{
    private readonly GraphClient _graphClient;
    public WriteInNeo4J()
    {
        _graphClient = new GraphClient(new Uri("http://127.0.1.1:7474/db/data"), username: "neo4j", password: "25112005");
    }

    public async void Demo()
    {
        _graphClient.Cypher.Match("system").CreateDatabase("demo");
        _graphClient.Cypher.CreateDatabase("demo");
        _graphClient.Cypher.CreateOrReplaceDatabase("demo");
        await _graphClient.ConnectAsync();
    }
}

And with none of the 3 ways that happens it works for me I always have the same error:

System.InvalidOperationException: DATABASE commands are not supported in Neo4j versions older than 4.0 at Neo4jClient.Cypher.CypherFluentQuery.DatabaseAdministrationChecks(String databaseName, Boolean ignoreDatabaseName) at Neo4jClient.Cypher.CypherFluentQuery.CreateDatabase(String databaseName, Boolean ifNotExists) at ConsoleGetAllObjectsFromSp.Application.WriteInNeo4J.Demo() in /media/arturo/Backup-DD/Proyects/ConsoleGetTables/ConsoleGetAllObjectsFromSp/Application/WriteInNeo4J.cs:line 16 at System.Threading.Tasks.Task.<>c.b__139_1(Object state) at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

cskardon commented 3 years ago

Can you run these commands in the browser? I thought community didn't let you as multiple tenancy was an Enterprise thing

arturotrenard commented 3 years ago

If correct I can not is a limitation of the version Good thank you. Only the error message doesn't really help.

cskardon commented 3 years ago

Definitely - the error message should be improved, and in principle, I'm not sure why you'd get that, and I'll look into it. But that's why I asked if you could do it in the browser - as I wanted to see if my thoughts were correct!