简体   繁体   中英

Cassandra Datastax Node.js driver can't find keyspace

Just installed Cassandra (3.11.1) and Datastax node.js driver (3.3.0).

Created a simple structure:

CREATE KEYSPACE CaseBox
   WITH REPLICATION={
     'class': 'SimpleStrategy',
     'replication_factor': 1};
USE CaseBox;

CREATE TABLE Regions (
    regionId int,
    name varchar,
    PRIMARY KEY ((regionId))
);

Trying connect to the keyspace with no success:

const client = new cassandra.Client({
  contactPoints: ['localhost'],
  keyspace: 'CaseBox'
});

await client.connect();

Error: Keyspace 'CaseBox' does not exist . If I change the desired kayspace to system it works. What's wrong? Please assist.

You can find my full Cassandra config, CQL and js scripts here .

Keyspace names are forced lower case when unquoted in CQL .

Use CREATE KEYSPACE "CaseBox" in CQL or keyspace: 'casebox' in Node.

Generally just use snake_case names as you won't get trapped like this as often.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM