> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: updateExternalDatabaseConnection(name: string, externalDatabaseConnection: UpdateExternalDatabaseConnection) # Method package: wixDataV2 # Method menu location: wixDataV2 --> externalDatabaseConnections --> updateExternalDatabaseConnection # Method Link: https://dev.wix.com/docs/velo/apis/wix-data-v2/external-database-connections/update-external-database-connection.md # Method Description: Updates an external database connection. > **Note:** After an external database connection is updated, it only contains the values provided in the request. All previous values are lost. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Update an existing external database connection (dashboard page code) ```javascript import { externalDatabaseConnections } from "wix-data.v2"; import { elevate } from "wix-auth"; const elevatedUpdateExternalDatabaseConnection = elevate(externalDatabaseConnections.updateExternalDatabaseConnection); /* * Sample name value: 'connectionOne' * * Sample externalDatabaseConnection object: * * { * capabilities: { * collectionModificationsSupported: false, * fieldTypes: [] * }, * configuration: { * secretKey: '74dbd6d6-ec5b-4668-8229-c77379bc6431', * username: 'Jane Doe' * }, * endpoint: 'https://example.com/my-external-database' * } */ export async function myUpdateExternalDatabaseConnectionFunction(name, externalDatabaseConnection) { try { const updateExternalDatabaseConnectionResponse = await elevatedUpdateExternalDatabaseConnection(name, externalDatabaseConnection); console.log(`The ${name} connection was updated with the new values. It is currently mounted at ${updateExternalDatabaseConnectionResponse.endpoint}`); return updateExternalDatabaseConnectionResponse; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "capabilities": { * "collectionModificationsSupported": false, * "fieldTypes": [] * } * "configuration": { * "secretKey": "74dbd6d6-ec5b-4668-8229-c77379bc6431", * "username": "Jane Doe" * }, * "connectionStatus": { * "successful": true, * "causeOfFailure": "NONE", * "hasCollections": "YES" * }, * "endpoint": "https://example.com/my-external-database", * "name": "connection1", * "protocolVersion": "" * } */ ``` ## Update an existing external database connection (export from backend code) ```javascript import { Permissions, webMethod } from "wix-web-module"; import { externalDatabaseConnections } from "wix-data.v2"; import { elevate } from "wix-auth"; const elevatedUpdateExternalDatabaseConnection = elevate(externalDatabaseConnections.updateExternalDatabaseConnection); /* * Sample name value: 'connectionOne' * * Sample externalDatabaseConnection object: * * { * capabilities: { * collectionModificationsSupported: false, * fieldTypes: [] * }, * configuration: { * secretKey: '74dbd6d6-ec5b-4668-8229-c77379bc6431', * username: 'Jane Doe' * }, * endpoint: 'https://example.com/my-external-database' * } */ export const myUpdateExternalDatabaseConnectionFunction = webMethod( Permissions.Admin, async (name, externalDatabaseConnection) => { try { const updateExternalDatabaseConnectionResponse = await elevatedUpdateExternalDatabaseConnection(name, externalDatabaseConnection); console.log(`The ${name} connection was updated with the new values. It is currently mounted at ${updateExternalDatabaseConnectionResponse.endpoint}`); return updateExternalDatabaseConnectionResponse; } catch (error) { console.error(error); // Handle the error } } ) /* Promise resolves to: * { * "capabilities": { * "collectionModificationsSupported": false, * "fieldTypes": [] * } * "configuration": { * "secretKey": "74dbd6d6-ec5b-4668-8229-c77379bc6431", * "username": "Jane Doe" * }, * "connectionStatus": { * "successful": true, * "causeOfFailure": "NONE", * "hasCollections": "YES" * }, * "endpoint": "https://example.com/my-external-database", * "name": "connection1", * "protocolVersion": "" * } */ ``` ---