如何从cassandra会话获取密钥空间名称

gab6jxml  于 2021-06-14  发布在  Cassandra
关注(0)|答案(1)|浏览(378)

当我创建会话时,将keyspace\u name作为api cluster.connect(keyspacename)的输入。是否还有/api可以从会话中获取keyspace\u name?
会话创建

String cKeyspace="inventory_flip"
Session session = cluster.connect(cKeyspace);

如何从现有的cassandradb会话中获取密钥空间?

session.getXXXXX?
xdnvmnnf

xdnvmnnf1#

public interface Session extends Closeable {

  /**
   * The keyspace to which this Session is currently logged in, if any.
   *
   * <p>This correspond to the name passed to {@link Cluster#connect(String)}, or to the last
   * keyspace logged into through a "USE" CQL query if one was used.
   *
   * @return the name of the keyspace to which this Session is currently logged in, or {@code null}
   *     if the session is logged to no keyspace.
   */
  String getLoggedKeyspace();

相关问题