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
-
You have installed seekdb-js. For more information, see Quick start.
-
You have installed the server mode of seekdb. For more information, see Deploy seekdb by using yum install.
-
You have connected to the database. For more information, see SeekdbAdminClient.
Request parameters
getDatabase(name: string, tenant?: string)
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
name | string | Yes | The name of the queried database. | my_database |
tenant | string | No
| 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
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
name | string | Yes | The name of the queried database. | my_database |
tenant | string | No | The tenant to which the queried database belongs. When using seekdb, this parameter is not returned. | sys |
charset | string | No | The character set used by the queried database. | utf8mb4 |
collation | string | No | The collation used by the queried database. | utf8mb4_bin |
metadata | dict | No | Reserved field. No data is returned. | {} |
Response example
Database {
name: 'my_database',
charset: 'utf8mb4',
collation: 'utf8mb4_bin',
metadata: {}
}