The goal of this extension is to simplify the ability to run scripts against your database connections. It works around the concept of having a config file in the root of your project with a list of all your connection details.
Search the marketplace for odb-task
and click the install button. Depends on having SQL*Plus or SQLcl available on your system (I recommend going to the effort of installing SQL*Plus).
- Open your project
- Create a file in your project root named
.build-oracle.json
- Update the contents per the below example
- Reload Code just to make sure everything is detected
The best way to create a shortcut for build is to define it in keyboard shortcuts.
- Ensure you have run a compile task - the command doesn't appear in the keyboard shortcuts settings until you have successfully run the task
- Navigate to Keyboard Shortcuts: File -> Preferences -> Keyboard Shortcuts
- Search
odb-task
and set your desired keyboard binding
Alternatively, you can just add to your keybindings.json file directly:
{
"key": "ctrl+shift+b",
"command": "odb-task.compileSqlPlus"
}
The command
property can be either: odb-task.compileSqlPlus
or odb-task.compileSqcl
.
[
{
"targetName": "DEV",
"connectionString": "user/password@XE"
}
]
Open the command palette and type Compile with
. You will see two entries:
- Compile with SQL*Plus
- Compile with SQLcl
note: This extension doesn't ship with these binaries, so it assumes if you are running one or the other, the command is available on your system.
Choose the interpreter you wish to compile with.
You will prompted for which connection to compile against. Choose the connection name.
As mentioned, this extension depends on the binaries for SQL*Plus or SQLcl being available on your system. These default to sqlplus
and sql
respectively. If these are not within your Path, or have been renamed to something else, you can set an alternative path/name within settings.
Trent Schafer
MIT