The read-write region which contains the database's leader replicas. If this value was not
explicitly set during a create database or update database ddl operations, it will be
NULL.
Returns the version retention period of the database. This is the period for which Cloud
Spanner retains all versions of data for the database. For instance, if set to 3 days, Cloud
Spanner will retain data versions that are up to 3 days old.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Class DatabaseInfo (6.98.1)\n\nVersion latestkeyboard_arrow_down\n\n- [6.98.1 (latest)](/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.DatabaseInfo)\n- [6.98.0](/java/docs/reference/google-cloud-spanner/6.98.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.97.1](/java/docs/reference/google-cloud-spanner/6.97.1/com.google.cloud.spanner.DatabaseInfo)\n- [6.96.1](/java/docs/reference/google-cloud-spanner/6.96.1/com.google.cloud.spanner.DatabaseInfo)\n- [6.95.1](/java/docs/reference/google-cloud-spanner/6.95.1/com.google.cloud.spanner.DatabaseInfo)\n- [6.94.0](/java/docs/reference/google-cloud-spanner/6.94.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.93.0](/java/docs/reference/google-cloud-spanner/6.93.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.89.0](/java/docs/reference/google-cloud-spanner/6.89.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.88.0](/java/docs/reference/google-cloud-spanner/6.88.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.87.0](/java/docs/reference/google-cloud-spanner/6.87.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.86.0](/java/docs/reference/google-cloud-spanner/6.86.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.85.0](/java/docs/reference/google-cloud-spanner/6.85.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.83.0](/java/docs/reference/google-cloud-spanner/6.83.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.82.0](/java/docs/reference/google-cloud-spanner/6.82.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.80.1](/java/docs/reference/google-cloud-spanner/6.80.1/com.google.cloud.spanner.DatabaseInfo)\n- [6.79.0](/java/docs/reference/google-cloud-spanner/6.79.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.77.0](/java/docs/reference/google-cloud-spanner/6.77.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.74.1](/java/docs/reference/google-cloud-spanner/6.74.1/com.google.cloud.spanner.DatabaseInfo)\n- [6.72.0](/java/docs/reference/google-cloud-spanner/6.72.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.71.0](/java/docs/reference/google-cloud-spanner/6.71.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.69.0](/java/docs/reference/google-cloud-spanner/6.69.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.68.0](/java/docs/reference/google-cloud-spanner/6.68.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.66.0](/java/docs/reference/google-cloud-spanner/6.66.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.65.1](/java/docs/reference/google-cloud-spanner/6.65.1/com.google.cloud.spanner.DatabaseInfo)\n- [6.62.0](/java/docs/reference/google-cloud-spanner/6.62.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.60.0](/java/docs/reference/google-cloud-spanner/6.60.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.58.0](/java/docs/reference/google-cloud-spanner/6.58.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.57.0](/java/docs/reference/google-cloud-spanner/6.57.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.56.0](/java/docs/reference/google-cloud-spanner/6.56.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.55.0](/java/docs/reference/google-cloud-spanner/6.55.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.54.0](/java/docs/reference/google-cloud-spanner/6.54.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.53.0](/java/docs/reference/google-cloud-spanner/6.53.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.52.1](/java/docs/reference/google-cloud-spanner/6.52.1/com.google.cloud.spanner.DatabaseInfo)\n- [6.51.0](/java/docs/reference/google-cloud-spanner/6.51.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.50.1](/java/docs/reference/google-cloud-spanner/6.50.1/com.google.cloud.spanner.DatabaseInfo)\n- [6.49.0](/java/docs/reference/google-cloud-spanner/6.49.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.25.1](/java/docs/reference/google-cloud-spanner/6.25.1/com.google.cloud.spanner.DatabaseInfo)\n- [6.24.0](/java/docs/reference/google-cloud-spanner/6.24.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.23.4](/java/docs/reference/google-cloud-spanner/6.23.4/com.google.cloud.spanner.DatabaseInfo)\n- [6.22.0](/java/docs/reference/google-cloud-spanner/6.22.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.21.2](/java/docs/reference/google-cloud-spanner/6.21.2/com.google.cloud.spanner.DatabaseInfo)\n- [6.20.0](/java/docs/reference/google-cloud-spanner/6.20.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.19.1](/java/docs/reference/google-cloud-spanner/6.19.1/com.google.cloud.spanner.DatabaseInfo)\n- [6.18.0](/java/docs/reference/google-cloud-spanner/6.18.0/com.google.cloud.spanner.DatabaseInfo)\n- [6.17.4](/java/docs/reference/google-cloud-spanner/6.17.4/com.google.cloud.spanner.DatabaseInfo)\n- [6.14.1](/java/docs/reference/google-cloud-spanner/6.14.1/com.google.cloud.spanner.DatabaseInfo) \n\n public class DatabaseInfo\n\nRepresents a Cloud Spanner database. \n\nInheritance\n-----------\n\n[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e DatabaseInfo \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nConstructors\n------------\n\n### DatabaseInfo(DatabaseId id, DatabaseInfo.State state)\n\n public DatabaseInfo(DatabaseId id, DatabaseInfo.State state)\n\nMethods\n-------\n\n### equals(Object o)\n\n public boolean equals(Object o)\n\n**Overrides** \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)\n\n### getCreateTime()\n\n public Timestamp getCreateTime()\n\nReturns the creation time of the database.\n\n### getDefaultLeader()\n\n public String getDefaultLeader()\n\nThe read-write region which contains the database's leader replicas. If this value was not\nexplicitly set during a create database or update database ddl operations, it will be `\nNULL`.\n\n### getDialect()\n\n public Dialect getDialect()\n\nThe dialect that is used by the database. It can be one of the values as specified in [Dialect#values()](/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.Dialect#com_google_cloud_spanner_Dialect_values__).\n\n### getEarliestVersionTime()\n\n public Timestamp getEarliestVersionTime()\n\nReturns the earliest version time of the database. This is the oldest timestamp that can be\nused to read old versions of the data.\n\n### getEncryptionConfig()\n\n public CustomerManagedEncryption getEncryptionConfig()\n\nReturns the [CustomerManagedEncryption](/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.encryption.CustomerManagedEncryption) of the database if the database is encrypted, or\n`null` if this database is not encrypted.\n\n### getId()\n\n public DatabaseId getId()\n\nReturns the database id.\n\n### getProto()\n\n public Database getProto()\n\nReturns the raw proto instance that was used to construct this [Database](/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.admin.database.v1.Database).\n\n### getProtoDescriptors()\n\n public ByteString getProtoDescriptors()\n\n### getReconciling()\n\n public boolean getReconciling()\n\n### getRestoreInfo()\n\n public RestoreInfo getRestoreInfo()\n\nReturns the [RestoreInfo](/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.RestoreInfo) of the database if any is available, or `null` if no\n[RestoreInfo](/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.RestoreInfo) is available for this database.\n\n### getState()\n\n public DatabaseInfo.State getState()\n\nReturns the state of the database.\n\n### getVersionRetentionPeriod()\n\n public String getVersionRetentionPeriod()\n\nReturns the version retention period of the database. This is the period for which Cloud\nSpanner retains all versions of data for the database. For instance, if set to 3 days, Cloud\nSpanner will retain data versions that are up to 3 days old.\n\n### hashCode()\n\n public int hashCode()\n\n**Overrides** \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)\n\n### isDropProtectionEnabled()\n\n public boolean isDropProtectionEnabled()\n\n### toString()\n\n public String toString()\n\n**Overrides** \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--)"]]