Elffuss BraidHub

kikocis/java-driver public

f01502dcbaf7 · 6.2 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.12.1](https://github.com/datastax/java-driver/tree/2.0.12.1).*
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://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/Session.html#execute(com.datastax.driver.core.Statement)
30[async]: http://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/Session.html#executeAsync(com.datastax.driver.core.Statement)
31[simple_st]: http://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/SimpleStatement.html
32[prepared_st]: http://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/Session.html#prepare(com.datastax.driver.core.RegularStatement)
33[batch_st]: http://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/BatchStatement.html
34[pool]: features/pooling/
35[lbp]: http://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/policies/LoadBalancingPolicy.html
36[retry_policy]: http://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/policies/RetryPolicy.html
37[query_builder]: http://docs.datastax.com/en/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
50**Community:**
51
52- JIRA: https://datastax-oss.atlassian.net/browse/JAVA
53- MAILING LIST: https://groups.google.com/a/lists.datastax.com/forum/#!forum/java-driver-user
54- IRC: #datastax-drivers on [irc.freenode.net](http://freenode.net)
55- TWITTER: [@dsJavaDriver](https://twitter.com/dsJavaDriver) tweets Java
56 driver releases and important announcements (low frequency).
57 [@DataStaxEng](https://twitter.com/datastaxeng) has more news including
58 other drivers, Cassandra, and DSE.
59- DOCS: the [user guide](http://docs.datastax.com/en/developer/java-driver/2.0/java-driver/whatsNew2.html)
60 has introductory material. We are progressively migrating the doc
61 [here](features/) with more technical details.
62- API: http://docs.datastax.com/en/drivers/java/2.0
63
64**Feeback requested:** help us focus our efforts, provide your input on the [Platform and Runtime Survey](http://goo.gl/forms/qwUE6qnL7U) (we kept it short).
65
66
67## Getting the driver
68
69The latest release of the driver is available on Maven Central. You can install
70it in your application using the following Maven dependency:
71
72```xml
73<dependency>
74 <groupId>com.datastax.cassandra</groupId>
75 <artifactId>cassandra-driver-core</artifactId>
76 <version>2.0.12.1</version>
77</dependency>
78```
79
80We also provide a [shaded JAR](http://datastax.github.io/java-driver/features/shaded_jar/)
81to avoid the explicit dependency to Netty.
82
83If you can't use a dependency management tool, a
84[binary tarball](http://downloads.datastax.com/java-driver/cassandra-java-driver-2.0.12.1.tar.gz)
85is available for download.
86
87## Compatibility
88
89The Java client driver 2.0 ([branch 2.0](https://github.com/datastax/java-driver/tree/2.0)) is compatible with Apache
90Cassandra 1.2 and 2.0, but some features are available only when using Apache Cassandra 2.0 (e.g. result set paging,
91[BatchStatement](https://github.com/datastax/java-driver/blob/2.0/driver-core/src/main/java/com/datastax/driver/core/BatchStatement.java),
92[lightweight transactions](http://docs.datastax.com/en/cql/3.1/cql/cql_using/use_ltweight_transaction_t.html)
93-- see [What's new in Cassandra 2.0](http://docs.datastax.com/en/cassandra/2.0/cassandra/features/features_key_c.html)).
94Trying to use these with a cluster running Cassandra 1.2 will result in
95an [UnsupportedFeatureException](https://github.com/datastax/java-driver/blob/2.0/driver-core/src/main/java/com/datastax/driver/core/exceptions/UnsupportedFeatureException.java) being thrown.
96
97## Upgrading from 1.x branch
98
99If you are upgrading from the 1.x branch of the driver, be sure to have a look at
100the [upgrade guide](upgrade_guide/).
101
102We used the opportunity of a major version bump to incorporate your feedback and improve the API,
103to fix a number of inconsistencies and remove cruft.
104Unfortunately this means there are some breaking changes, but the new API should be both simpler and more complete.
105
106### Troubleshooting
107
108If you are having issues connecting to the cluster (seeing `NoHostAvailableConnection` exceptions) please check the
109[connection requirements](https://github.com/datastax/java-driver/wiki/Connection-requirements).
110
111## License
112Copyright 2012-2015, DataStax
113
114Licensed under the Apache License, Version 2.0 (the "License");
115you may not use this file except in compliance with the License.
116You may obtain a copy of the License at
117
118http://www.apache.org/licenses/LICENSE-2.0
119
120Unless required by applicable law or agreed to in writing, software
121distributed under the License is distributed on an "AS IS" BASIS,
122WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
123See the License for the specific language governing permissions and
124limitations under the License.