【问题标题】:How to call database name using gremlin like sql? In net core如何使用 sql 之类的 gremlin 调用数据库名称?在网络核心
【发布时间】:2021-02-17 06:52:09
【问题描述】:

SQL:

String connectionString = "Server=192.168.1.10;Database=exampledb;User Id=testuser;Password=testpass;"; SqlConnection sqlConnection = new SqlConnection(connectionString);

其中:

  • 服务器:主机名
  • 数据库:名称数据库
  • 用户:用户名
  • 密码:密码

小鬼

var gremlinServer = new GremlinServer("localhost", 8182, true, 用户名密码); var gremlinServer = 新 GremlinServer("localhost", 8182);

其中: 上面的代码没有名称数据库,如何创建数据库名称并作为SQL端调用呢? 我要创建并调用数据库:exampledb

我正在使用 .net 核心,JanusGraph

【问题讨论】:

    标签: .net .net-core graph gremlin janusgraph


    【解决方案1】:

    您将要连接的图形命名为DriverRemoteConnection 构造的参数:

    var remoteConnection = new DriverRemoteConnection(new GremlinClient(new GremlinServer("localhost", 8182)), "mygraph");
    var g = Traversal().WithRemote(remoteConnection);
    

    您可以在这里看到我将要在服务器上绑定的图形指定为“mygraph”(如果未指定任何内容,它通常默认为“g”。)如果您将脚本发送到服务器,那么您只需使用脚本中 TraversalSource 绑定的名称,例如:mygraph.V().out()

    请注意,您需要在 JanusGraph Server 中配置“mygraph”(即使用 JanusGraph 库重新打包 Gremlin 服务器)。虽然 Gremlin 本身没有像 SQL 这样的“CREATE DATABASE”函数,但 JanusGraph 确实有一个特殊的 GraphFactoryGraphManager 可以让你拥有这种行为 - 你可以阅读更多关于 here 的信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-11
      • 2020-11-02
      • 1970-01-01
      • 1970-01-01
      • 2019-08-23
      • 2017-12-25
      相关资源
      最近更新 更多