Search.../

deleteExternalDatabaseConnection( )

Developer Preview

Deletes an external database connection.

Description

Note: Once an external database connection is deleted, it can't be restored. To reconnect the database you need to create a new external database connection.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function deleteExternalDatabaseConnection(name: string): Promise<void>

deleteExternalDatabaseConnection Parameters

NAME
TYPE
DESCRIPTION
name
string

Name of the external database connection to delete.

Returns

Return Type:

Promise<
void
>

Was this helpful?

Delete an external database connection

Copy Code
1import { Permissions, webMethod } from "wix-web-module";
2import { externalDatabaseConnections } from "wix-data.v2";
3import { elevate } from "wix-auth";
4
5const elevatedDeleteExternalDbConnection = elevate(externalDatabaseConnections.deleteExternalDatabaseConnection);
6
7/*
8 * Sample name value: 'ConnectionOne'
9 */
10
11export const myDeleteExternalDbConnection = webMethod(
12 Permissions.Admin,
13 async (name) => {
14 try {
15 await elevatedDeleteExternalDbConnection(name);
16
17 return;
18 } catch (error) {
19 console.error(error);
20 // Handle the error
21 }
22 }
23)
24
25/* Promise resolves to void */