作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试使用 JDBC 驱动程序连接到 Cassandra DB:
Class.forName("org.apache.cassandra.cql.jdbc.CassandraDriver");
Connection con = DriverManager.getConnection("jdbc:cassandra://10.11.15.242:9042/edgeview");
我无法连接到 Cassandra。它总是给出以下错误:
org.apache.thrift.transport.TTransportException: Read a negative frame size (-2080374784)!
我添加了以下库:
Cassandra-jdbc-1.2.5.jar
Cassandra-thrift-1.2.6.jar
Cassandra-clientutil-1.2.6.jar
libthrift-0.9.0.jar
如有任何帮助,我们将不胜感激。
最佳答案
DriverManager.getConnection("jdbc:cassandra://10.11.15.242:9042/edgeview");
所以 9042 是 native 二进制协议(protocol)连接的端口,9160 是 Thrift 的端口。
您需要弄清楚您是通过 Thrift 还是 Native 进行连接,并使用适当的端口。鉴于您的错误消息,听起来 JDBC Cassandra 使用 Thrift,因此您可能需要指定 9160 作为您的端口。
当然,通过 Thrift 连接已被弃用,甚至在 Cassandra 2.2+ 中默认禁用。
关于java - 组织.apache.thrift.transport.TTransportException : Read a negative frame size (-2080374784)!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38918292/
我是一名优秀的程序员,十分优秀!