Skip to main content
Version: V1.1.0

getDatabase - Get the specified database

The getDatabase() method is used to retrieve information about the specified database.

info

This API can only be used when connected with SeekdbAdminClient. For more information about SeekdbAdminClient, see SeekdbAdminClient.

Prerequisites

Request parameters

getDatabase(name: string, tenant?: string)
ParameterTypeRequiredDescriptionExample value
namestringYesThe name of the queried database.my_database
tenantstringNo
  • When using the server mode of seekdb, this parameter is not required.
  • When using OceanBase Database, this parameter is required.
The tenant to which the queried database belongs.test_tenant

Request example

import { SeekdbAdminClient } from "seekdb";

// Remote server mode - database management (seekdb Server)
const admin = new SeekdbAdminClient({
host: "127.0.0.1",
port: 2881,
user: "root",
password: ""
});

const db = await admin.getDatabase("my_database");

Response parameters

ParameterTypeRequiredDescriptionExample value
namestringYesThe name of the queried database.my_database
tenantstringNoThe tenant to which the queried database belongs.
When using seekdb, this parameter is not returned.
sys
charsetstringNoThe character set used by the queried database.utf8mb4
collationstringNoThe collation used by the queried database.utf8mb4_bin
metadatadictNoReserved field. No data is returned.{}

Response example

Database {
name: 'my_database',
charset: 'utf8mb4',
collation: 'utf8mb4_bin',
metadata: {}
}