Cassandra Java datastax 2.1.8无法使用引号

时间:2016-10-28 13:38:29

标签: java cassandra datastax cassandra-2.1

我有一段简单的代码用于从cassandra 2中删除数据

Cluster myCluster = Cluster.builder().addContactPoint(myhost).withPort(myport).build();

Session session = myCluster.connect(keyspaceName);
session.excecute(deleteStatement); -- it is just simple Delete.Where

所以基本上当我尝试做某事时(例如)keyspaceName =" test" 它很容易超出我的删除声明,但如果我尝试相同的东西(例如)keyspace =" \" DONT_WORK \"" (因为我在cassandra中的引号中有一个键空间名称)它不会起作用,并且会抛出

com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1:16660 (com.datastax.driver.core.ConnectionException: [localhost/127.0.0.1:16660] Pool is shutdown))
at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:84)
at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37)
at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:214)

我需要帮助

PS。我甚至使用了来自datastax库的Metadata.quote()静态方法 - 仍然无法正常工作。

2 个答案:

答案 0 :(得分:0)

您不需要引用键空间名称进行连接。引用对于在CQL字符串的上下文中保护区分大小写很重要,但如果要将键空间名称作为API参数传递,则不需要保护它。

答案 1 :(得分:0)

好的,没有必要进一步调查这个问题。问题是我偶然在版本2.0.8上的cassandra上使用了2.1.8 datastax库。我必须停止使用数字keyborad。简单的错误,但肯定是一个大惊小怪。

相关问题