在创建会话时,将keyspace\u名称作为api cluster.connect(keyspace name)的输入。是否还有/api可以从会话中获取keyspace\u名称?
会话创建
String cKeyspace="inventory_flip"
Session session = cluster.connect(cKeyspace);
如何从现有的CasDANRA 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();
关于database - 如何从cassandra session 中获取 key 空间名称,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56358989/