How to connect to a specific graph on Gremlin Server?

Provided a Gremlin server configured with multiple graphs in the graph property of the gremlin server configuration as below:
host: localhost
port: 8182
evaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
  graph: conf/tinkergraph-empty.properties, otherGraph: conf/tinkergraph-empty.properties}
...etc


How to specify which graph to connect to in Java (either using RemoteDriverConnection or Client)? I'd assumed DriverRemoteConnection.using(cluster, traversalSourceName) was the place to do this, but that clearly not it!
I'm noticing the Client class allows specifying an alias but that doesn't seem to work either.
What's the proper way of configuring multiple graphs on a server and then connecting to them in Java?
Solution
we have a Gremlin Server startup script which uses the ConfiguredGraphFactory to look up the application's graph and which creates it if not yet present.
I think that shouldn't be necessary as ConfiguredGraphFactory should already create a graph traversal source automatically for every created graph with then name <graph.graphname>_traversal. But you can of course still do it like that if you want to
Was this page helpful?