Elffuss BraidHub

kikocis/java-driver public

ed6a18bdb8a6 · 6.7 KiBRenderedRawPermalink
1# Datastax Java Driver for Apache Cassandra
2
3![Travis Build](https://travis-ci.org/datastax/java-driver.svg?branch=2.0)
4
5*If you're reading this on github.com, please note that this is the readme
6for the development version and that some features described here might
7not yet have been released. You can find the documentation for latest
8version through [Java driver
9docs](http://datastax.github.io/java-driver/) or via the release tags,
10[e.g.
112.0.10](https://github.com/datastax/java-driver/tree/2.0.10).*
12
13A modern, [feature-rich](features/) and highly tunable Java client
14library for Apache Cassandra (1.2+) and DataStax Enterprise (3.1+) using
15exclusively Cassandra's binary protocol and Cassandra Query Language v3.
16
17**Features:**
18
19* [Sync][sync] and [Async][async] API
20* [Simple][simple_st], [Prepared][prepared_st], and [Batch][batch_st] statements
21* Asynchronous IO, parallel execution, request pipelining
22* [Connection pooling][pool]
23* Auto node discovery
24* Automatic reconnection
25* Configurable [load balancing][lbp] and [retry policies][retry_policy]
26* Works with any cluster size
27* [Query builder][query_builder]
28
29[sync]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/Session.html#execute(com.datastax.driver.core.Statement)
30[async]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/Session.html#executeAsync(com.datastax.driver.core.Statement)
31[simple_st]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/SimpleStatement.html
32[prepared_st]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/Session.html#prepare(com.datastax.driver.core.RegularStatement)
33[batch_st]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/BatchStatement.html
34[pool]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/PoolingOptions.html
35[lbp]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/policies/LoadBalancingPolicy.html
36[retry_policy]: http://datastax.com/drivers/java/2.0/com/datastax/driver/core/policies/RetryPolicy.html
37[query_builder]: http://www.datastax.com/drivers/java/2.0/com/datastax/driver/core/querybuilder/QueryBuilder.html
38
39The driver architecture is based on layers. At the bottom lies the driver core.
40This core handles everything related to the connections to a Cassandra
41cluster (for example, connection pool, discovering new nodes, etc.) and exposes a simple,
42relatively low-level API on top of which higher level layers can be built.
43
44The driver contains the following modules:
45
46- driver-core: the core layer.
47- driver-examples: example applications using the other modules which are
48 only meant for demonstration purposes.
49
50More modules including a simple object mapper will come shortly.
51
52Please refer to the README of each module for more information.
53
54**Community:**
55
56- JIRA: https://datastax-oss.atlassian.net/browse/JAVA
57- MAILING LIST: https://groups.google.com/a/lists.datastax.com/forum/#!forum/java-driver-user
58- IRC: #datastax-drivers on [irc.freenode.net](http://freenode.net)
59- TWITTER: Follow the latest news about DataStax Drivers - [@olim7t](http://twitter.com/olim7t), [@mfiguiere](http://twitter.com/mfiguiere)
60- DOCS: http://www.datastax.com/documentation/developer/java-driver/2.0/index.html
61- API: http://www.datastax.com/drivers/java/2.0
62- CHANGELOG: https://github.com/datastax/java-driver/blob/2.0/driver-core/CHANGELOG.rst
63
64## What's new in 2.0.10
65
66* [Speculative query execution](features/speculative_execution/)
67* [Query logger](features/logging/#logging-query-latencies)
68* Access to the [paging state](features/paging/#manual-paging)
69* Don't mark hosts down on client timeouts, and remove "suspected"
70 mechanism
71* Upgrade to Netty 4 and internal improvements around connection
72 handling
73* New connection pool resizing algorithm
74* [Connection heartbeat](features/pooling/#heartbeat)
75* Address translation for [EC2
76 multi-region](features/address_resolution/#ec2-multi-region) deployments
77* Changes to [dependency shading](features/shaded_jar/), and fixes to
78 OSGI deployment descriptors
79* Expose [token metadata](features/metadata/#token-metadata)
80
81For the full list of tickets, refer to the
82[changelog](https://github.com/datastax/java-driver/blob/2.0/driver-core/CHANGELOG.rst).
83
84## Maven
85
86The last release of the driver is available on Maven Central. You can install
87it in your application using the following Maven dependency:
88
89```xml
90<dependency>
91 <groupId>com.datastax.cassandra</groupId>
92 <artifactId>cassandra-driver-core</artifactId>
93 <version>2.0.10</version>
94</dependency>
95```
96
97We also provide a [shaded JAR](http://datastax.github.io/java-driver/features/shaded_jar/)
98to avoid the explicit dependency to Netty.
99
100## Compatibility
101
102The Java client driver 2.0 ([branch 2.0](https://github.com/datastax/java-driver/tree/2.0)) is compatible with Apache
103Cassandra 1.2 and 2.0, but some features are available only when using Apache Cassandra 2.0 (e.g. result set paging,
104[BatchStatement](https://github.com/datastax/java-driver/blob/2.0/driver-core/src/main/java/com/datastax/driver/core/BatchStatement.java),
105[lightweight transactions](http://www.datastax.com/documentation/cql/3.1/cql/cql_using/use_ltweight_transaction_t.html)
106-- see [What's new in Cassandra 2.0](http://www.datastax.com/documentation/cassandra/2.0/cassandra/features/features_key_c.html)).
107Trying to use these with a cluster running Cassandra 1.2 will result in
108an [UnsupportedFeatureException](https://github.com/datastax/java-driver/blob/2.0/driver-core/src/main/java/com/datastax/driver/core/exceptions/UnsupportedFeatureException.java) being thrown.
109
110## Upgrading from 1.x branch
111
112If you are upgrading from the 1.x branch of the driver, be sure to have a look at
113the [upgrade guide](https://github.com/datastax/java-driver/blob/2.0/driver-core/Upgrade_guide_to_2.0.rst).
114
115We used the opportunity of a major version bump to incorporate your feedback and improve the API,
116to fix a number of inconsistencies and remove cruft.
117Unfortunately this means there are some breaking changes, but the new API should be both simpler and more complete.
118
119### Troubleshooting
120
121If you are having issues connecting to the cluster (seeing `NoHostAvailableConnection` exceptions) please check the
122[connection requirements](https://github.com/datastax/java-driver/wiki/Connection-requirements).
123
124## License
125Copyright 2012-2015, DataStax
126
127Licensed under the Apache License, Version 2.0 (the "License");
128you may not use this file except in compliance with the License.
129You may obtain a copy of the License at
130
131http://www.apache.org/licenses/LICENSE-2.0
132
133Unless required by applicable law or agreed to in writing, software
134distributed under the License is distributed on an "AS IS" BASIS,
135WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
136See the License for the specific language governing permissions and
137limitations under the License.