Scylla Documentation Logo Documentation
  • Server
    • Scylla Open Source
    • Scylla Enterprise
    • Scylla Alternator
  • Cloud
    • Scylla Cloud
    • Scylla Cloud Docs
  • Tools
    • Scylla Manager
    • Scylla Monitoring Stack
    • Scylla Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
Download
Menu

Caution

You're viewing documentation for a previous version of Scylla Java Driver. Switch to the latest stable version.

Scylla Java Driver Manual Statements

Statements¶

To execute a query, you create a Statement instance and pass it to Session#execute() or Session#executeAsync. The driver provides various implementations:

  • SimpleStatement: a simple implementation built directly from a character string. Typically used for queries that are executed only once or a few times.

  • BoundStatement: obtained by binding values to a prepared statement. Typically used for queries that are executed often, with different values.

  • BuiltStatement: a statement built with the QueryBuilder DSL. It can be executed directly like a simple statement, or prepared.

  • BatchStatement: a statement that groups multiple statements to be executed as a batch.

Customizing execution¶

Before executing a statement, you might want to customize certain aspects of its execution. Statement provides a number of methods for this, for example:

Statement s = new SimpleStatement("select release_version from system.local");
s.enableTracing();
session.execute(s);

If you use custom policies (RetryPolicy, LoadBalancingPolicy, SpeculativeExecutionPolicy…), you might also want to have custom properties that influence statement execution. To achieve this, you can wrap your statements in a custom StatementWrapper implementation.

PREVIOUS
SSL
NEXT
Simple statements
  • 3.7.2.x
    • 4.13.0.x
    • 4.12.0.x
    • 4.11.1.x
    • 4.10.0.x
    • 4.7.2.x
    • 3.11.2.x
    • 3.11.0.x
    • 3.10.2.x
    • 3.7.2.x
  • Scylla Java Driver for Scylla and Apache Cassandra®
  • API Documentation
  • Manual
    • Address resolution
    • Asynchronous programming
    • Authentication
    • Compression
    • Control connection
    • Custom Codecs
    • Custom Payloads
    • Query idempotence
    • Load balancing
    • Logging
    • Metadata
    • Metrics
    • Native protocol
    • Object Mapper
      • Definition of mapped classes
      • Using custom codecs
      • Using the mapper
    • OSGi
    • Paging
    • Connection pooling
    • Query timestamps
    • Reconnection
    • Retries
    • Using the shaded JAR
    • Socket options
    • Speculative query execution
    • SSL
    • Statements
      • Simple statements
      • Prepared statements
      • Built statements
      • Batch statements
    • Using Tuples with the Java driver
    • User-defined types
  • Upgrade guide
    • Migrating from Astyanax
      • Configuration
      • Language change : from Thrift to CQL
      • Queries and Results
  • Frequently Asked Questions
  • Changelog
  • Create an issue
  • Edit this page

On this page

  • Statements
    • Customizing execution
Logo
Docs Contact Us About Us
Mail List Icon Slack Icon
© 2022, ScyllaDB. All rights reserved.
Last updated on 25 May 2022.
Powered by Sphinx 4.3.2 & ScyllaDB Theme 1.2.2