cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Serega Sheypak <serega.shey...@gmail.com>
Subject Re: com.datastax.driver.core.exceptions.SyntaxError: line 1:37 no viable alternative at character
Date Wed, 24 Jun 2015 10:00:23 GMT
omg!!!
It was some weird unprinted character. That is why C* driver failed to
parse it....

2015-06-24 11:35 GMT+02:00 Serega Sheypak <serega.sheypak@gmail.com>:

> Sorry, misprint
> //composeQuery() => INSERT INTO packets (id, fingerprint, mark) VALUES
> (?, ?, ?);
> PreparedStatement preparedStatement = session.prepare(composeQuery());
> //exception happens here!
>
> 2015-06-24 11:20 GMT+02:00 Serega Sheypak <serega.sheypak@gmail.com>:
>
>> Hi, I'm trying to use bounded query and I get  weird error:
>>
>> Here is a query:
>>
>> Bounded query: INSERT INTO packets (id, fingerprint, mark) VALUES (?, ?,
>> ?);
>>
>>
>> Here is a code:
>>
>> PreparedStatement preparedStatement = session.prepare(composeQuery());
>> //composeQuery returns INSERT INTO packets (id, fingerprint, mark) VALUES
>> (?, ?, ?);
>>
>> BoundStatement boundStatement = new BoundStatement(preparedStatement);
>> //EXCEPTION HERE
>>
>> boundStatement.bind(UUID.randomUUID(), RandomStringUtils.random(10), 1);
>>
>> session.execute(boundStatement);
>> If I use cqlsh and run
>>
>> INSERT INTO packets (id, fingerprint, mark) VALUES (now(), 'xxx', 1);
>> it works
>>
>> Stacktrace:
>>
>> Exception in thread "main"
>> com.datastax.driver.core.exceptions.SyntaxError: line 1:37 no viable
>> alternative at character ' '
>>
>> at
>> com.datastax.driver.core.exceptions.SyntaxError.copy(SyntaxError.java:35)
>>
>> at
>> com.datastax.driver.core.DefaultResultSetFuture.extractCauseFromExecutionException(DefaultResultSetFuture.java:289)
>>
>> at
>> com.datastax.driver.core.AbstractSession.prepare(AbstractSession.java:79)
>>
>> at stress.StressTest.runBound(StressTest.java:89)
>>
>> at stress.Main.main(Main.java:29)
>>
>> Caused by: com.datastax.driver.core.exceptions.SyntaxError: line 1:37 no
>> viable alternative at character ' '
>>
>> at
>> com.datastax.driver.core.Responses$Error.asException(Responses.java:101)
>>
>> at
>> com.datastax.driver.core.SessionManager$1.apply(SessionManager.java:185)
>>
>> at
>> com.datastax.driver.core.SessionManager$1.apply(SessionManager.java:160)
>>
>> at com.google.common.util.concurrent.Futures$1.apply(Futures.java:720)
>>
>> at
>> com.google.common.util.concurrent.Futures$ChainingListenableFuture.run(Futures.java:859)
>>
>> at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>
>>  at java.lang.Thread.run(Thread.java:745)
>>
>>
>>
>

Mime
View raw message