Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8197287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:42:34+00:00 2026-06-07T05:42:34+00:00

when i create column family using the cql it gives me very unexpected output.

  • 0

when i create column family using the cql it gives me very unexpected output.

public static void createColumnfamily()
    {
        try
        {
            Class.forName("org.apache.cassandra.cql.jdbc.CassandraDriver");
            Connection con = DriverManager.getConnection("jdbc:cassandra://192.168.1.32:9160/temp");
            String qry = "CREATE TABLE users(user_name varchar," +
                                            "password varchar," +
                                            "gender varchar," +
                                            "session_token varchar," +
                                            "birth_year bigint," +
                                            "PRIMARY KEY (user_name)" +
                                            ")";
            Statement smt = con.createStatement();
            smt.executeUpdate(qry);
            System.out.println("TABLE(column family) is created");
            con.close();
        }
        catch(Exception e)
        {
            System.out.println(" : " + e.getMessage());
        }

    }

Here what i got : line 1:132 extraneous input ‘)’ expecting EOF

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:42:35+00:00Added an answer on June 7, 2026 at 5:42 am

    You’re using CQL 2, which does not support that style of primary key declaration. If you want to declare it that way, you should be using CQL 3, which you can accomplish by requesting that version in the connection URL:

    DriverManager.getConnection("jdbc:cassandra://192.168.1.32:9160/temp?version=3.0.0");
    

    However, CQL 3 isn’t necessary just for this. As Steve Van Opstal suggested, you can simply put the PRIMARY KEY marker with the column definition itself, since you don’t have a multi-component primary key.

    CREATE TABLE users(
        user_name varchar PRIMARY KEY,
        password varchar,
        gender varchar,
        session_token varchar,
        birth_year bigint,
    );
    

    CQL 3 is to be generally preferred if your Cassandra supports it, as it is the way forward, but in case you don’t want to switch right now, you can make that second change.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using cassandra-cli and have been trying to create a column family with
i have a column family use counter as create table command below: (KEY i
I'm using this layout to create a 2 column fluid web page. What I
I am trying to create a Super Column Family that will replicate a structure
I'm using jqgrid for which I create column definitions on server as dynamic objects
I'm using a MSSQL database and would like to create a column that only
I'm triyng to create a column family with TimeUUIDType as name of row: create
If I try to create a column whose value is a select returning more
I have the column DateTimeExpired, and I would like to create another column called
Goal: to create a percentage column based off the values of calculated columns. Here's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.