Get a database admin (Java)

The Data API clients use the Database Admin class to perform administrative operations, like managing keyspaces, within a specific database.

The Database Admin class name varies by client. The Java client uses DatabaseAdmin.

Result

Returns a DatabaseAdmin object that can perform administrative actions on the specified database.

Parameters

Use the getDatabaseAdmin method from the com.datastax.astra.client.Database class.

Method signature
DatabaseAdmin getDatabaseAdmin()
DatabaseAdmin getDatabaseAdmin(String superUserToken)
DatabaseAdmin getDatabaseAdmin(AdminOptions adminOptions)
Name Type Summary

superUserToken

String

Optional. The token used by the resulting admin object. The token should have sufficient permissions to perform the desired downstream operations.

If not specified, the resulting object will use the token used by the object that called this method.

adminOptions

AdminOptions

Optional. A specification of options to override the inherited defaults. Use this to customize the interaction of the client with the database admin. For example, you can change the default timeouts.

Examples

The following examples demonstrate how to get a database admin object.

Get a database admin from a database

import com.datastax.astra.client.DataAPIClients;
import com.datastax.astra.client.admin.DatabaseAdmin;
import com.datastax.astra.client.databases.Database;

public class Example {

  public static void main(String[] args) {
    // Get a database object
    Database database =
        DataAPIClients.clientHCD("USERNAME", "PASSWORD")
            .getDatabase("API_ENDPOINT", "KEYSPACE_NAME");

    // Get a database admin object
    DatabaseAdmin databaseAdmin = database.getDatabaseAdmin();
  }
}

Client reference

For more information, see the client reference.

Was this helpful?

Give Feedback

How can we improve the documentation?

© Copyright IBM Corporation 2026 | Privacy policy | Terms of use Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: Contact IBM