简体   繁体   English

使用Datastax Java驱动程序的com.datastax.driver.core.exceptions.InvalidQueryException

[英]com.datastax.driver.core.exceptions.InvalidQueryException using Datastax Java driver

I created my column family like this from the CLI- 我从CLI创建了这样的列系列

create column family profile
    with key_validation_class = 'UTF8Type'
    and comparator = 'UTF8Type'
    and default_validation_class = 'UTF8Type'
    and column_metadata = [
      {column_name : account, validation_class : 'UTF8Type'}
      {column_name : advertising, validation_class : 'UTF8Type'}
      {column_name : behavior, validation_class : 'UTF8Type'}
      {column_name : info, validation_class : 'UTF8Type'}
      ];

Now I was trying to insert into this column family using the Datastax Java driver- 现在我尝试使用Datastax Java驱动程序插入此列族 -

public void upsertAttributes(final String userId, final Map<String, String> attributes) {

String batchInsert = "INSERT INTO PROFILE(id, account, advertising, behavior, info) VALUES ( '12345', 'hello11', 'bye2234', 'bye1', 'bye2') "; 

        CassandraDatastaxConnection.getInstance().getSession().execute(batchInsert);

    }

I am always getting this exception- 我总是得到这个例外 -

com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured columnfamily profile com.datastax.driver.core.exceptions.InvalidQueryException:unconfigured columnfamily profile

And by this way, I am trying to create connection/session initialization to Cassandra using Datastax java driver- 通过这种方式,我试图使用Datastax java驱动程序创建连接/会话初始化到Cassandra-

private CassandraDatastaxConnection() {

    try{
    cluster = Cluster.builder().addContactPoint("localhost").build();
    session = cluster.connect("my_keyspace");           
    } catch (NoHostAvailableException e) {

            throw new RuntimeException(e);
    }
}

I am running Cassandra 1.2.3. 我正在运行Cassandra 1.2.3。 And I am able to connect to Cassandra using the above code. 我可以使用上面的代码连接到Cassandra。 The only problem I am facing is while inserting. 我面临的唯一问题是插入时。

The thing that I wanted to know is whether I can insert into Column Family (that I have created from CLI mode) using Datastax Java driver or not? 我想知道的是我是否可以使用Datastax Java驱动程序插入Column Family(我是从CLI模式创建的)? As soon as I am trying to insert into Column Family which I have created in CLI mode, I always get the above exception. 一旦我尝试插入我在CLI模式下创建的Column Family,我总是得到上述异常。

But If I try to insert into another table that I have created in CQLsh mode , I am able to insert into that. 但是,如果我尝试插入我在CQLsh mode创建的另一个表,我可以插入到该表中。

Any help will be appreciated. 任何帮助将不胜感激。

我的猜测:您的CLI列系列位于不同的键空间中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 com.datastax.driver.core.exceptions.InvalidQueryException:未配置的表用户” - com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table user" com.datastax.driver.core.exceptions.InvalidQueryException:未配置的表schema_keyspaces - com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table schema_keyspaces com.datastax.driver.core.exceptions.InvalidQueryException: 未配置表 peers_v2 - com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table peers_v2 卡桑德拉数据库。 com.datastax.driver.core.exceptions.InvalidQueryException:未配置的表人 - Cassandra DB. com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table person 引起:com.datastax.driver.core.exceptions.InvalidQueryException:日期 (25) 的预期长度为 8 或 0 字节 - Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Expected 8 or 0 byte long for date (25) 线程“ main”中的异常com.datastax.driver.core.exceptions.InvalidQueryException:PRIMARY KEY中引用的未知定义 - Exception in thread “main” com.datastax.driver.core.exceptions.InvalidQueryException: Unknown definition referenced in PRIMARY KEY `InvalidQueryException:无法使用Datastax Java驱动程序将“ [B @ 50908fa9”解析为十六进制字节” - `InvalidQueryException: cannot parse '[B@50908fa9' as hex bytes` using Datastax Java driver Paging Datastax Java驱动程序 - Paging Datastax java driver Datastax java 驱动程序 4 上的 GenericDao - GenericDao on Datastax java driver 4 我应该为“ com.datastax.driver.core.exceptions.ReadTimeoutException”做什么? - what should I do for “com.datastax.driver.core.exceptions.ReadTimeoutException”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM