卡桑德拉数据库。 com.datastax.driver.core.exceptions.InvalidQueryException: 未配置 table 人
Cassandra DB. com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table person
The keyspace and 'person' table are exist
你好,我是 Cassandra 的新手,所以我只是想从我的 java 代码中执行 select 查询,但我得到一个例外,即 table 是不存在(但它存在。检查上面的 link)。
请帮助我找出可能导致此问题的原因。
提前谢谢你。
public class DS_Cassandra implements DS
{
Cluster cluster;
Session session;
private static final Logger log = Logger.getLogger( DS_Cassandra.class.getName() );
public DS_Cassandra()
{
cluster = Cluster.builder().addContactPoint("127.0.0.1").build();
session = cluster.connect("testing");
}
@Override
public ArrayList<Person> read()
{
ArrayList<Person> list = new ArrayList<Person>();
ResultSet results = session.execute("SELECT * FROM person"); //and here exception happened
2016-03-02 22:06:26 INFO NettyUtil:83 - Did not find Netty's native epoll transport in the classpath, defaulting to NIO.
2016-03-02 22:06:26 INFO DCAwareRoundRobinPolicy:95 - Using data-center name 'datacenter1' for DCAwareRoundRobinPolicy (if this is incorrect, please provide the correct datacenter name with DCAwareRoundRobinPolicy constructor)
2016-03-02 22:06:26 INFO Cluster:1475 - New Cassandra host /127.0.0.1:9042 added
Exception in thread "main" com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table person
at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:50)
at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37)
at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245)
at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:63)
at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:39)...
Table 名称区分大小写。
尝试使用 table 名称添加您的键空间名称。
对于你的情况:“SELECT * FROM my_keyspace_name.person”
The keyspace and 'person' table are exist
你好,我是 Cassandra 的新手,所以我只是想从我的 java 代码中执行 select 查询,但我得到一个例外,即 table 是不存在(但它存在。检查上面的 link)。 请帮助我找出可能导致此问题的原因。 提前谢谢你。
public class DS_Cassandra implements DS
{
Cluster cluster;
Session session;
private static final Logger log = Logger.getLogger( DS_Cassandra.class.getName() );
public DS_Cassandra()
{
cluster = Cluster.builder().addContactPoint("127.0.0.1").build();
session = cluster.connect("testing");
}
@Override
public ArrayList<Person> read()
{
ArrayList<Person> list = new ArrayList<Person>();
ResultSet results = session.execute("SELECT * FROM person"); //and here exception happened
2016-03-02 22:06:26 INFO NettyUtil:83 - Did not find Netty's native epoll transport in the classpath, defaulting to NIO.
2016-03-02 22:06:26 INFO DCAwareRoundRobinPolicy:95 - Using data-center name 'datacenter1' for DCAwareRoundRobinPolicy (if this is incorrect, please provide the correct datacenter name with DCAwareRoundRobinPolicy constructor)
2016-03-02 22:06:26 INFO Cluster:1475 - New Cassandra host /127.0.0.1:9042 added
Exception in thread "main" com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table person
at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:50)
at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37)
at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245)
at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:63)
at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:39)...
Table 名称区分大小写。
尝试使用 table 名称添加您的键空间名称。
对于你的情况:“SELECT * FROM my_keyspace_name.person”