Elffuss BraidHub

kikocis/java-driver public

9b2e3dd1def4 · 7.0 KiBRenderedRawPermalink
1# Datastax Java Driver for Apache Cassandra
2
3[![Build Status](https://travis-ci.org/datastax/java-driver.svg?branch=3.0)](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.
113.0.0-rc1](https://github.com/datastax/java-driver/tree/3.0.0-rc1).*
12
13A modern, [feature-rich](manual/) 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/3.0/com/datastax/driver/core/Session.html#execute-com.datastax.driver.core.Statement-
32[async]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Session.html#executeAsync-com.datastax.driver.core.Statement-
33[simple_st]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/SimpleStatement.html
34[prepared_st]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Session.html#prepare-com.datastax.driver.core.RegularStatement-
35[batch_st]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/BatchStatement.html
36[pool]: manual/pooling/
37[lbp]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/policies/LoadBalancingPolicy.html
38[retry_policy]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/policies/RetryPolicy.html
39[query_builder]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/querybuilder/QueryBuilder.html
40[mapper]: http://docs.datastax.com/en/drivers/java/3.0/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
54**Useful links:**
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: [@dsJavaDriver](https://twitter.com/dsJavaDriver) tweets Java
60 driver releases and important announcements (low frequency).
61 [@DataStaxEng](https://twitter.com/datastaxeng) has more news including
62 other drivers, Cassandra, and DSE.
63- DOCS: the [user guide](http://docs.datastax.com/en/developer/java-driver/2.1/java-driver/whatsNew2.html)
64 has introductory material. We are progressively migrating the doc
65 [here](manual/) with more technical details.
66- API: http://www.datastax.com/drivers/java/3.0
67- [changelog](changelog/)
68- [binary tarball](http://downloads.datastax.com/java-driver/cassandra-java-driver-3.0.0-rc1.tar.gz)
69
70**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).
71
72## Getting the driver
73
74The last release of the driver is available on Maven Central. You can install
75it in your application using the following Maven dependency:
76
77```xml
78<dependency>
79 <groupId>com.datastax.cassandra</groupId>
80 <artifactId>cassandra-driver-core</artifactId>
81 <version>3.0.0-rc1</version>
82</dependency>
83```
84
85Note that the object mapper is published as a separate artifact:
86
87```xml
88<dependency>
89 <groupId>com.datastax.cassandra</groupId>
90 <artifactId>cassandra-driver-mapping</artifactId>
91 <version>3.0.0-rc1</version>
92</dependency>
93```
94
95The 'extras' module is also published as a separate artifact:
96
97```xml
98<dependency>
99 <groupId>com.datastax.cassandra</groupId>
100 <artifactId>cassandra-driver-extras</artifactId>
101 <version>3.0.0-rc1</version>
102</dependency>
103```
104
105
106We also provide a [shaded JAR](manual/shaded_jar/)
107to avoid the explicit dependency to Netty.
108
109If you can't use a dependency management tool, a
110[binary tarball](http://downloads.datastax.com/java-driver/cassandra-java-driver-3.0.0-rc1.tar.gz)
111is available for download.
112
113## Compatibility
114
115The Java client driver 3.0 ([branch 3.0](https://github.com/datastax/java-driver/tree/3.0)) is compatible with Apache
116Cassandra 1.2, 2.0, 2.1, 2.2 and 3.0 (see [this page](http://datastax.github.io/java-driver/manual/native_protocol) for
117the most up-to-date compatibility information).
118
119UDT and tuple support is available only when using Apache Cassandra 2.1 or higher (see [CQL improvements in Cassandra 2.1](http://www.datastax.com/dev/blog/cql-in-2-1)).
120
121Other features are available only when using Apache Cassandra 2.0 or higher (e.g. result set paging,
122[BatchStatement](https://github.com/datastax/java-driver/blob/3.0/driver-core/src/main/java/com/datastax/driver/core/BatchStatement.java),
123[lightweight transactions](http://www.datastax.com/documentation/cql/3.1/cql/cql_using/use_ltweight_transaction_t.html)
124-- see [What's new in Cassandra 2.0](http://www.datastax.com/documentation/cassandra/2.0/cassandra/features/features_key_c.html)).
125Trying to use these with a cluster running Cassandra 1.2 will result in
126an [UnsupportedFeatureException](https://github.com/datastax/java-driver/blob/3.0/driver-core/src/main/java/com/datastax/driver/core/exceptions/UnsupportedFeatureException.java) being thrown.
127
128
129## Upgrading from previous versions
130
131If you are upgrading from a previous version of the driver, be sure to have a look at
132the [upgrade guide](/upgrade_guide/).
133
134
135### Troubleshooting
136
137If you are having issues connecting to the cluster (seeing `NoHostAvailableConnection` exceptions) please check the
138[connection requirements](https://github.com/datastax/java-driver/wiki/Connection-requirements).
139
140
141## License
142Copyright 2012-2015, DataStax
143
144Licensed under the Apache License, Version 2.0 (the "License");
145you may not use this file except in compliance with the License.
146You may obtain a copy of the License at
147
148http://www.apache.org/licenses/LICENSE-2.0
149
150Unless required by applicable law or agreed to in writing, software
151distributed under the License is distributed on an "AS IS" BASIS,
152WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
153See the License for the specific language governing permissions and
154limitations under the License.