Protocol Error

53 views
Skip to first unread message

Vivekananda Nayak

unread,
Aug 8, 2016, 7:48:59 AM8/8/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Dear All,

I am getting Protocol Error [run time error ] when i am executing below code.

-----------------------------------------------------------------------

rc = executeStatement(
string("INSERT INTO simplex.songs (id, title, album, artist, tags) ") +
"VALUES (" +
"756716f7-2e54-4715-9f00-91dcbea6cf50," +
"'La Petite Tonkinoise'," +
"'Bye Bye Blackbird'," +
"'Joséphine Baker'," +
"{'jazz', '2013'})" +
";");

-----------------------------------------------------------------------

any pointers here....? what exactly the problem...?

i have attached visual studio project in zip file.

Thanks and Regards
Vivek

simple.piz

Michael Penick

unread,
Aug 8, 2016, 1:19:58 PM8/8/16
to cpp-dri...@lists.datastax.com
Hi,

What version of cpp-driver and Cassandra?

Mike


--
You received this message because you are subscribed to the Google Groups "DataStax C++ Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cpp-driver-user+unsubscribe@lists.datastax.com.

Michael Fero

unread,
Aug 8, 2016, 1:28:49 PM8/8/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Vivek,

The error returned in your example is CASS_ERROR_SERVER_PROTOCOL_ERROR; however the actual error returned by the server is 'Cannot decode string as UTF8' due to the improperly encoded std::string (e.g. the é in Joséphine Baker). To get the detailed error you should use the future and `cass_future_error_message` whenever the error code is not CASS_OK.

Before your simple statements are executed you will need to make sure that the cstring is properly encoded when using the extended ASCII set in your statements. C++11 (which is not available in Visual Studio 2010) offers a simple enoding for string literals.

~Fero

Vivekananda Nayak

unread,
Aug 9, 2016, 2:18:34 AM8/9/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Hi , I am using :Cassandra v3.7.0 ,cpp-driver-389_build_fixes

Regards
Vivek
> To unsubscribe from this group and stop receiving emails from it, send an email to cpp-driver-us...@lists.datastax.com.

Vivekananda Nayak

unread,
Aug 9, 2016, 2:22:21 AM8/9/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Dear Fero,

Thank you. Removed special characters ...now working but i have another strange issues, getting some junk data when i am trying to print accessed data..? any issues here..?. attached snapshot...
Capture.PNG

Michael Fero

unread,
Aug 10, 2016, 9:31:11 AM8/10/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Vivek,

You are not printing out your results correctly; the strings returned from `cass_value_get_string` are not null terminated which is why the length is provided. Since you are using C++ functionality, convert the value with length to a std::string before printing.

~Fero

Vivekananda Nayak

unread,
Aug 11, 2016, 1:07:48 AM8/11/16
to cpp-dri...@lists.datastax.com
Dear Fero,

Thank you. just wanted to know few things

1. how can I connect to Casandra  DB from Web Page..? do i need any web server..?.

2. If web server required Can i use Tomcat..? what additional drivers required..? is any simple examples are available..? please do let me know

Regards
Vivek


--
You received this message because you are subscribed to the Google Groups "DataStax C++ Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cpp-driver-user+unsubscribe@lists.datastax.com.

Michael Fero

unread,
Aug 15, 2016, 9:02:17 AM8/15/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Vivek,

Glad to help.

In order to interface your external C++ application to a web server you will need to determine your requirements and choose the web server that is applicable to those requirements; see FastCGI wiki to get yourself started (https://en.wikipedia.org/wiki/FastCGI). As far as examples, you can utilize the resources in the C/C++ driver repository (https://github.com/datastax/cpp-driver/tree/master/examples) and the DataStax Academy (https://academy.datastax.com) to portal to help further your knowledge and experience with Cassandra.

~Fero

Vivekananda Nayak

unread,
Aug 16, 2016, 4:51:01 AM8/16/16
to cpp-dri...@lists.datastax.com
Dear Fero,

Thank you.

I am getting some error when i am trying to connect to Casandra DB. tried to figure out from command prompt, i got below log 

---------------------------------------------------------------------------------------------------------------------

C:\Program Files\DataStax-DDC\apache-cassandra\bin>net start DataStax_DDC_Server

The DataStax DDC Server 3.7.0 service is starting.
The DataStax DDC Server 3.7.0 service was started successfully.


C:\Program Files\DataStax-DDC\apache-cassandra\bin>nodetool status
nodetool: Failed to connect to '127.0.0.1:7199' - ConnectException: 'Connection
refused: connect'.

C:\Program Files\DataStax-DDC\apache-cassandra\bin>net stop DataStax_DDC_Server
The DataStax DDC Server 3.7.0 service is not started.

More help is available by typing NET HELPMSG 3521.
---------------------------------------------------------------------------------------------------------------------------------------------

is  any work around to this issue..?

Regards
Vivek




~Fero

Michael Fero

unread,
Aug 16, 2016, 8:45:30 AM8/16/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Vivek,

It sounds like you do not have JMX enabled. You will want to modify the cassandra.bat file and restart the Cassandra instance; see https://github.com/apache/cassandra/blob/cassandra-3.7/bin/cassandra.bat#L71-L75. You may also need to add -Djava.rmi.server.hostname=127.0.0.1.

~Fero

Vivekananda Nayak

unread,
Aug 18, 2016, 12:45:54 AM8/18/16
to cpp-dri...@lists.datastax.com
Dear Fero,

Thank you for your update.

I have checked your hints and changes are part of the Casandra now. even after changes still i have same issue.

attached log for your reference. Can you pls check once

Regards
Vivek




~Fero

logs.7z

Michael Fero

unread,
Aug 19, 2016, 2:00:51 PM8/19/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Vivek,

From the looks of things you are running through PowerShell (which is good), so the changes to the cassandra.bat file are not necessary and you will need to edit cassandra-env.ps1 (which it looks like you have already done so).

The steps I am providing below will allow you to use nodetool locally, but this is also unsecure due to the disabling of the security; please read up on JMX security measures and consult the documentation for enabling JMX https://docs.datastax.com/en/cassandra_win/3.x/cassandra/configuration/secureJmxAuthentication.html.

1. Uncomment https://github.com/apache/cassandra/blob/cassandra-3.7/conf/cassandra-env.ps1#L448
2. Uncomment https://github.com/apache/cassandra/blob/cassandra-3.7/conf/cassandra-env.ps1#L452 and change the value to false
3. Uncomment https://github.com/apache/cassandra/blob/cassandra-3.7/conf/cassandra-env.ps1#L463 and change the value to false
4. Restart your Cassandra instance

With these steps completed you should now be able to run commands like `nodetool status` and `nodetool ring` on the same machine the Cassandra instance is running. If you have further issues with Apache Cassandra please direct your questions to the Apache Cassandra mailing list http://www.mail-archive.com/us...@cassandra.apache.org/info.html and utilize this forum for C/C++ driver related questions.

Thank you.

~Fero

Vivekananda Nayak

unread,
Aug 22, 2016, 10:27:09 PM8/22/16
to cpp-dri...@lists.datastax.com
Dear Fero,

Thanks for your inputs. I will take a note of your input.

Regards
VIvek


~Fero

Reply all
Reply to author
Forward
0 new messages