簡體   English   中英

如何從cassandra會話中獲取密鑰空間名稱

[英]How to get the keyspace name from cassandra session

當我創建會話時,將keyspace_name用作API cluster.connect(keyspaceName)的輸入。是否/ api在哪里可以從會話中獲取keyspace_name?

會話創建

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

如何從現有的cassandra DB會話中獲取密鑰空間?

session.getXXXXX?
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();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM