我正在创建将keyspace_name用作API cluster.connect(keyspaceName)输入的会话时,反正/ api是否可以从会话中获取keyspace_name?
会话创建
String cKeyspace="inventory_flip"
Session session = cluster.connect(cKeyspace);
如何从现有的cassandra DB会话中获取密钥空间?
session.getXXXXX?
答案 0 :(得分:2)
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();