Elffuss BraidHub

kikocis/java-driver public

c79f03f7223a · 6.3 KiBRenderedRawPermalink
1# Datastax Java Driver for Apache Cassandra
2
3[![Build Status](https://travis-ci.org/datastax/java-driver.svg?branch=2.1)](https://travis-ci.org/datastax/java-driver)
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.1.6](https://github.com/datastax/java-driver/tree/2.1.6).*
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* [Object mapper][mapper]
29
30
31[sync]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/Session.html#execute(com.datastax.driver.core.Statement)
32[async]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/Session.html#executeAsync(com.datastax.driver.core.Statement)
33[simple_st]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/SimpleStatement.html
34[prepared_st]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/Session.html#prepare(com.datastax.driver.core.RegularStatement)
35[batch_st]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/BatchStatement.html
36[pool]: features/pooling/
37[lbp]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/policies/LoadBalancingPolicy.html
38[retry_policy]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/policies/RetryPolicy.html
39[query_builder]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/querybuilder/QueryBuilder.html
40[mapper]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/mapping/MappingManager.html
41
42The driver architecture is based on layers. At the bottom lies the driver core.
43This core handles everything related to the connections to a Cassandra
44cluster (for example, connection pool, discovering new nodes, etc.) and exposes a simple,
45relatively low-level API on top of which higher level layers can be built.
46
47The driver contains the following modules:
48
49- driver-core: the core layer.
50- driver-mapping: the object mapper.
51- driver-examples: example applications using the other modules which are
52 only meant for demonstration purposes.
53
54Please refer to the README of each module for more information.
55
56**Community:**
57
58- JIRA: https://datastax-oss.atlassian.net/browse/JAVA
59- MAILING LIST: https://groups.google.com/a/lists.datastax.com/forum/#!forum/java-driver-user
60- IRC: #datastax-drivers on [irc.freenode.net](http://freenode.net)
61- TWITTER: Follow the latest news about DataStax Drivers - [@olim7t](http://twitter.com/olim7t), [@mfiguiere](http://twitter.com/mfiguiere)
62- DOCS: http://www.datastax.com/documentation/developer/java-driver/2.1/index.html
63- API: http://www.datastax.com/drivers/java/2.1
64- CHANGELOG: https://github.com/datastax/java-driver/blob/2.1/driver-core/CHANGELOG.rst
65
66## Maven
67
68The last release of the driver is available on Maven Central. You can install
69it in your application using the following Maven dependency:
70
71```xml
72<dependency>
73 <groupId>com.datastax.cassandra</groupId>
74 <artifactId>cassandra-driver-core</artifactId>
75 <version>2.1.6</version>
76</dependency>
77```
78
79Note that the object mapper is published as a separate artifact:
80
81```xml
82<dependency>
83 <groupId>com.datastax.cassandra</groupId>
84 <artifactId>cassandra-driver-mapping</artifactId>
85 <version>2.1.6</version>
86</dependency>
87```
88
89We also provide a [shaded JAR](features/shaded_jar/)
90to avoid the explicit dependency to Netty.
91
92## Compatibility
93
94The Java client driver 2.1 ([branch 2.1](https://github.com/datastax/java-driver/tree/2.1)) is compatible with Apache
95Cassandra 1.2, 2.0 and 2.1.
96
97UDT and tuple support is available only when using Apache Cassandra 2.1 (see [CQL improvements in Cassandra 2.1](http://www.datastax.com/dev/blog/cql-in-2-1)).
98
99Other features are available only when using Apache Cassandra 2.0 or higher (e.g. result set paging,
100[BatchStatement](https://github.com/datastax/java-driver/blob/2.1/driver-core/src/main/java/com/datastax/driver/core/BatchStatement.java),
101[lightweight transactions](http://www.datastax.com/documentation/cql/3.1/cql/cql_using/use_ltweight_transaction_t.html)
102-- see [What's new in Cassandra 2.0](http://www.datastax.com/documentation/cassandra/2.0/cassandra/features/features_key_c.html)).
103Trying to use these with a cluster running Cassandra 1.2 will result in
104an [UnsupportedFeatureException](https://github.com/datastax/java-driver/blob/2.1/driver-core/src/main/java/com/datastax/driver/core/exceptions/UnsupportedFeatureException.java) being thrown.
105
106
107## Upgrading from previous versions
108
109If you are upgrading from the 2.0.x branch of the driver, be sure to have a look at
110the [upgrade guide](https://github.com/datastax/java-driver/blob/2.1/driver-core/Upgrade_guide_to_2.1.rst).
111
112If you are upgrading from the 1.x branch, follow the [upgrade guide to 2.0](https://github.com/datastax/java-driver/blob/2.0/driver-core/Upgrade_guide_to_2.0.rst),
113and then the above document.
114
115
116### Troubleshooting
117
118If you are having issues connecting to the cluster (seeing `NoHostAvailableConnection` exceptions) please check the
119[connection requirements](https://github.com/datastax/java-driver/wiki/Connection-requirements).
120
121
122## License
123Copyright 2012-2015, DataStax
124
125Licensed under the Apache License, Version 2.0 (the "License");
126you may not use this file except in compliance with the License.
127You may obtain a copy of the License at
128
129http://www.apache.org/licenses/LICENSE-2.0
130
131Unless required by applicable law or agreed to in writing, software
132distributed under the License is distributed on an "AS IS" BASIS,
133WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134See the License for the specific language governing permissions and
135limitations under the License.