By using AWS re:Post, you agree to the Terms of Use

Can't access created keyspace/table via Java API


I have created a keyspace and tables via the AWS Console, and inserted some sample data via the console CQL editor, but I can't appear to access them via the Java API.

I have successfully configured the driver/session and ran the sample program as mentioned in the developer docs( ResultSet rs = session.execute("select * from system_schema.keyspaces");).

But when I attempt to run a simple select statement that works in the Console CQL editor I get a datastax error:
Exception in thread "main" com.datastax.oss.driver.api.core.servererrors.InvalidQueryException: unconfigured table table_keyspace.table_name

My searching leads me to believe that error message means the keyspace/table don't exist.

Is there something obvious I’m missing? If I can connect via the sample program, why can't I connect via the API?

Here is the config/code for reference:

datastax-java-driver { = \[ ""]  
    class = PlainTextAuthProvider  
    username = "xxxxxxx"  
    password = "xxxxxxxx"  
basic.load-balancing-policy {  
    local-datacenter = "us-east-2"  

advanced.ssl-engine-factory {  
    class = DefaultSslEngineFactory  
    truststore-path = "./src/main/resources/key/cassandra_truststore.jks"  
    truststore-password = "xxxxxxx"  

  metadata {  
      schema.enabled = false  
      token-map.enabled = false  
    connection.warn-on-init-error = false  


public class CassandraTestClass {

**public static void main( String\[] args )**  
    **//Use DriverConfigLoader to load your configuration file**  
    **DriverConfigLoader loader = DriverConfigLoader.fromClasspath("application.conf");**  
    **try (CqlSession session = CqlSession.builder()**  
            **.build()) {**  

        **ResultSet rs = session.execute("SELECT ** FROM test_keyspace.test_table_name;");*  
        **Row row =;**  


Edited by: lkalland on Dec 23, 2020 10:21 AM

Edited by: lkalland on Dec 23, 2020 10:24 AM

Edited by: lkalland on Dec 23, 2020 10:27 AM

Edited by: lkalland on Dec 23, 2020 10:28 AM

asked 2 years ago38 views
1 Answer

I'm an idiot. Was connecting to wrong region.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions