Getting started with VS Code Extension for DB2
VishDev2018 50232PFTJ6 Visits (3256)
This article explains the steps for installing the VS Code Extension for DB2 and explains features available in the extension.
Installing and configuring the extension
The Db2Connect extension is available in VS Market Place and can be installed by searching and selecting the extension in VS Code and choosing install option. There are three platform specific extension available at present. Select Db2Connect[windows version] for Windows.
Click on the install option to install the extension.
After the completion of installation, a message indicating the status of installation is displayed.
Features of Db2Connect
Creating Connection Profiles
Press F1 to select the Command Palette and choose Db2 : Manage Connection Profile to get Create and Edit options
To create a new profile select Create option.
Save and Close option saves the connection information.
For editing any existing profile select Db2 : Manage Connection Profile -> Edit option to open existing profiles for editing.
Connecting to DB2
Once the extension is installed, we can connect to any IBM Database server using the DB2 : Connect option
Inside VSCode, press F1 or Ctrl+Shft+P to bring up the VS Code Command Palette. Select Db2 : Connect option.
There are three options available for connecting:
1. Connect using a connection string.
2. Connect by providing individual connection parameter.
In the above screen, the hostname and port number are optional and are defaulted to localhost and port 50000 respectively.
If any of the required parameter is not specified, then that field is highlighted as error when trying to connect.
Once the connection is successful, a message will be displayed to indicate the status.
3. Connect using an existing Connection Profile.
Using the extension to fetch data
Select Db2 : Execute Query option to specify a select query and results will be displayed on the right hand side of the VS Code
Using the extension update database and database objects
The command Db2: Execute Non Query can be used to execute DDL statements. This can be used to create and modify any database objects.
The option Db2 : Disconnect closes the current connection. This feature is useful in switching from one connection to another new connection.
Disabling or uninstalling
The Uninstall option in the Extensions explorer can be used to uninstall this extension if it is no longer needed.