Search code examples
databaseneo4jcypher

How to query for the active database name in Cypher/Neo4J?


We have a multi-db setup on a stand-alone server. We can change the db which we query by :use ... where ... is the database to which queries are directed.

I would like to know if there is a query we can run to check which database we are currently running queries to, something like SHOW ACTIVE DATABASE or something like that.

Tried ACTIVE, CURRENT but neither seems to work. Tried checking for a field in SHOW DATABASES which may indicate the database I am currently querying towards. Nothing there either...

This should be possible but I couldn't find any documentation to it.


Solution

  • You can use the following query :

    CALL db.info()
    YIELD name