@oracle/sql-developer-api
v25.2.0
Published
Provides Typescript type definitions for the API exposed by Oracle SQL Developer Extension for VSCode
Downloads
57
Maintainers
Readme
Table of Contents
Introduction
Provides Typescript type definitions for the API exposed by Oracle SQL Developer Extension for VSCode.
Oracle SQL Developer Extension for VSCode provides the ability to manage database connections, execute SQL queries and scripts, perform PL/SQL development, and interact with database objects. The API enables developers to interact with these features programmatically, allowing them to create customized experiences on top of Oracle SQL Developer Extension for VSCode.
Getting Started
Prerequisites
Install Oracle SQL Developer Extension for VSCode
If you haven't already, install Oracle SQL Developer Extension for VSCode using the following link.
Note: The extension supports VSCode >=1.101.0, so make sure your VSCode version is at least 1.101.0.
Install Typescript:
NPM
npm install --save-dev typescriptYARN
yarn add --dev typescriptInstall Type definitions for VSCode
NPM
npm install --save-dev @types/vscodeYARN
yarn add --dev @types/vscodeInstallation
NPM
npm install --save-dev @oracle/sql-developer-apiYARN
yarn add --dev @oracle/sql-developer-apiUsage
The following code sample illustrates how to retrieve an API instance and use it:
const extensionId = 'Oracle.sql-developer';
const extension = vscode.extensions.getExtension<Api>(extensionId);
if (!extension) {
throw new Error(`Extension ${extensionId} is either not installed or disabled`);
}
const api = extension.exports;Connections
The API exposes a Connections interface, allowing access to connections and connection sessions. For instance, the following snippet allows retrieving the first connection in the connections list, connecting to it and executing a script against the session:
const connections = api.connections().list();
const session = await connections[0].connect();
const resultSet = await session.executeQuery({ sql: 'SELECT * FROM dual;' });The following table lists all available connection and connection session methods:
Worksheets
The API also exposes a Worksheets interface, that provides access to SQL worksheets. The following snippets illustrates how this interface can be leveraged to retrieve the content of the active worksheet and executes it against the attached session:
const activeWorksheet = api.worksheets().activeWorksheet;
const content = activeWorksheet.editor.document.getText();
const resultSet = await activeWorksheet.session.executeQuery({ sql: content });The following table lists all available worksheets methods:
Consult the code samples for more examples and code snippets on how to use different parts of the API.
Changelog
Refer to the changelog for full release notes and version history.
Contributing
Please review our contribution guide.
Security
Please consult the security guide for our responsible security vulnerability disclosure process.
License
Copyright (c) 2025 Oracle and/or its affiliates.
Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/.
