1

I am working with GridDB and trying to execute a SQL query, but I am getting an error. I have created a container and added some data to it. When I try to execute the query, I get an error message saying "Syntax error near 'query'". I have tried multiple times with different queries but getting the same error.

// Connect to GridDB cluster
GridStore *store = GridStoreFactory::get_instance()->get_gridstore("your_ip_address", 31810, "your_cluster_name", "your_username", "your_password");

// Get a collection
Collection<Row> *collection = store->get_collection<Row>("Data");

// Create a query object
Query<Row> queryObj = collection->query("SELECT * FROM your_container_name WHERE your_column_name = 'your_value'");

// Execute the query
RowSet<Row> *rs = queryObj.fetch();

// Iterate over the result set
while (rs->has_next()) {
    Row *row = rs->next();
    // Do something with the data
}

// Release the resources
delete rs;
delete collection;
store->close();

Griddb::Exception: Code: 4, Reason: GS_ERROR_QUERY_INVALID_SYNTAX, Invalid syntax for the specified query. (unknown error code): query="SELECT * FROM WHERE = 'value'"

1 Answer 1

0

What's the type you are querying? I ask because if you're querying a num/int/bool type, the single quotes will cause the query to fail. so if it's not a string type, remove the single quotes.

if it's timestamp type, of course you will need to do more transforming or share more info here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.