Oracle Developer Tools for Visual Studio Code

Posted by Dirk Nachbar on Thursday, June 20, 2019
Since yesterday Oracle published the Visual Studio Code Extension "Oracle Developer Tools for VS Code" https://www.oracle.com/database/technologies/appdev/dotnet/odtvscodequickstart.html

I am normally not a Microsoft guy, but I have to admit that the Visual Studio Code from Microsoft is really cool, even on my Ubuntu Laptop.

In order to setup the Oracle Developer Tools for VS Code on Ubuntu you will need to complete following pre-requirements:

Install at first the .NET Core 2.2 SDK for Linux Ubuntu
#
$ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
$ sudo dpkg -i packages-microsoft-prod.deb
[sudo] password for din: 
Selecting previously unselected package packages-microsoft-prod.
(Reading database ... 217409 files and directories currently installed.)
Preparing to unpack packages-microsoft-prod.deb ...
Unpacking packages-microsoft-prod (1.0-ubuntu18.04.2) ...
Setting up packages-microsoft-prod (1.0-ubuntu18.04.2) ...

$ sudo add-apt-repository universe
'universe' distribution component is already enabled for all sources.

sudo apt-get install apt-transport-https
Reading package lists... Done
Building dependency tree       
Reading state information... Done
apt-transport-https is already the newest version (1.6.11).
The following packages were automatically installed and are no longer required:
  linux-headers-4.18.0-20 linux-headers-4.18.0-20-generic linux-image-4.18.0-20-generic linux-modules-4.18.0-20-generic linux-modules-extra-4.18.0-20-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

$ sudo apt-get update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
. . .
. . .
Reading package lists... Done

$ sudo apt-get install dotnet-sdk-2.2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.18.0-20 linux-headers-4.18.0-20-generic linux-image-4.18.0-20-generic linux-modules-4.18.0-20-generic linux-modules-extra-4.18.0-20-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  aspnetcore-runtime-2.2 dotnet-host dotnet-hostfxr-2.2 dotnet-runtime-2.2 dotnet-runtime-deps-2.2 liblttng-ust-ctl4 liblttng-ust0 liburcu6
The following NEW packages will be installed:
  aspnetcore-runtime-2.2 dotnet-host dotnet-hostfxr-2.2 dotnet-runtime-2.2 dotnet-runtime-deps-2.2 dotnet-sdk-2.2 liblttng-ust-ctl4 liblttng-ust0 liburcu6
0 upgraded, 9 newly installed, 0 to remove and 3 not upgraded.
Need to get 135 MB of archives.
After this operation, 397 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ch.archive.ubuntu.com/ubuntu bionic/main amd64 liburcu6 amd64 0.10.1-1 [52.1 kB]
. . .
. . .
Welcome to .NET Core!
---------------------
Learn more about .NET Core: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs

Telemetry
---------
The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous and doesn't include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

Configuring...
--------------
A command is running to populate your local package cache to improve restore speed and enable offline access. This command takes up to one minute to complete and only runs once.
Processing triggers for libc-bin (2.27-3ubuntu1) ...
$

As next you can install the "Oracle Developer Tools for VS Code" within your Visual Studio Code.

Go on the Extensions (Crtl+Shift+X) and search for the "Oracle Developer Tools for VS Code" and install it.


After the Extension is installed open a simple SQL Script, in the down menu bar make sure, that the Oracle-SQL and PLSQL Language Mode is selected. Beside you will find the menu bar entry "Disconnected"


Click on the "Disconnected" or alternatively you can use the F1 key and choose "Oracle:Connect" and a popup window will open in which you have to provide your Database Connection "servername:ListenerPort/ServiceName"


As next you have to choose if it should be a "normal" (Non-Administrator) connection or "as sysdba" (Administrator)


Then provide your User ID (username)


In the next window you will have to provide the password of your user


Then choose if the password should be saved or not


Finally accept the default name for the connection to be saved or provide your own name for the connection to be saved


After that you can execute your SQL Script directly from Visual Studio Code against your database connection. Just make a right click in your SQL Script and choose the context menu option "Execute Query" or use Ctrl+E


The query result will be displayed in a new screen right beside your SQL Script


In the query result screen you have several options like save the output in CSV or JSON, copy selected rows to your clipboard and so on.

This extension from Oracle for Visual Studio Code is really cool and useful :-)


Categories: ,